mg
d7dd0ef313
zed defaults zed syntax scrub syntax sanoid mit ts health syntax arc syntax tmux syntax smart syntax restic handler restic syntax postfix syntax chrony syntax muster script mit ts muster syntax motd meta motd syntax smb syntax f2b syntax moreutils als standardsoftware rasdaemon + cv4pve. date durch ts ersetzt dokuwiki defaults dokuwiki syntax cv4 handler entfernt apt manage sources: / in var apt install packages syntax apcupsd syntax acng defaults acng syntax Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: mg/ansible#65 Co-Authored-By: mg <mg@noreply.git.mgrote.net> Co-Committed-By: mg <mg@noreply.git.mgrote.net>
28 lines
653 B
Bash
28 lines
653 B
Bash
#!/bin/bash
|
|
{{ file_header | default () }}
|
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
LOCKDIR=${HOME}/.cache
|
|
# Get an exclusive lock or exit
|
|
function exlock() {
|
|
exec {lock_fd}>${LOCKDIR}/$(basename $0).lock
|
|
flock -nx "$lock_fd"
|
|
if [[ $? == 1 ]]; then
|
|
exit 1
|
|
fi
|
|
}
|
|
# Cleanup lock file and exit
|
|
function unlock() {
|
|
rm "${LOCKDIR}/$(basename $0).lock"
|
|
[[ -n $1 ]] && exit $1
|
|
exit 0
|
|
}
|
|
|
|
|
|
# Damit prueft ob das Script ob es schon laeuft
|
|
exlock
|
|
|
|
/usr/local/bin/sanoid --cron --verbose | ts '%Y-%m-%d - %H-%M-%S' >> /var/log/sanoid-cron.log 2>&1 &
|
|
|
|
#Hiermit wird die Lockdatei geloescht
|
|
unlock
|