Adds safe-reboot and safe-shutdown, removes all .sh extensions to scripts

This commit is contained in:
2026-05-21 21:09:34 +02:00
parent f806bda21b
commit 9929a7055b
38 changed files with 91 additions and 44 deletions
+28
View File
@@ -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