Adds safe-reboot and safe-shutdown, removes all .sh extensions to scripts
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -o errexit -o pipefail -o noclobber -o nounset
|
||||
|
||||
echo "Running $(date)"
|
||||
torrents=/var/mnt/nas/containers/qbittorrent/storage/downloads/completed
|
||||
jdownloader=/var/mnt/nas/containers/jdownloader/storage/output/completed
|
||||
target=/var/mnt/nas/containers/nextcloud/storage/data/__groupfolders/1/files/downloads
|
||||
|
||||
num_torrents="$(find "${torrents}" -mindepth 1 -maxdepth 1 | wc -l)" || echo 0
|
||||
if [[ "${num_torrents}" -gt 0 ]]; then
|
||||
mv "${torrents}/"* "${target}/"
|
||||
fi
|
||||
echo "Found ${num_torrents} torrent files"
|
||||
num_jdownloader="$(find "${jdownloader}" -mindepth 1 -maxdepth 1 | wc -l)" || echo 0
|
||||
if [[ "${num_jdownloader}" -gt 0 ]]; then
|
||||
mv "${jdownloader}/"* "${target}/"
|
||||
fi
|
||||
echo "Found ${num_jdownloader} jdownloader files"
|
||||
total_files=$(("${num_torrents}" + "${num_jdownloader}"))
|
||||
if [[ "${total_files}" -gt 0 ]]; then
|
||||
chown --reference="${target}" -R "${target}/"*
|
||||
chmod --reference="${target}" -R "${target}/"*
|
||||
restorecon -vFR "${target}"
|
||||
echo "Running podman"
|
||||
cd /var/home/nextcloud
|
||||
sudo -u nextcloud podman exec -it nextcloud bash -c "/var/www/html/occ groupfolders:scan 1"
|
||||
cd -
|
||||
fi
|
||||
Reference in New Issue
Block a user