shellcheck fixes

This commit is contained in:
Fredrik Thulin 2023-02-06 16:41:04 +01:00
parent 906edf3caf
commit 3988f5beb0
No known key found for this signature in database
GPG key ID: 2707330D4030CCAD

View file

@ -16,29 +16,29 @@ lock() {
eval "exec $fd>$lock_file" eval "exec $fd>$lock_file"
# acquier the lock # acquier the lock
flock -n $fd \ flock -n "$fd" \
&& return 0 \ && return 0 \
|| return 1 || return 1
} }
eexit() { eexit() {
local error_str="$@" local error_str="$*"
echo $error_str echo "$error_str"
exit 1 exit 1
} }
main () { main () {
lock $PROGNAME || eexit "Only one instance of $PROGNAME can run at one time." lock "$PROGNAME" || eexit "Only one instance of $PROGNAME can run at one time."
cosmos $* update cosmos "$@" update
cosmos $* apply cosmos "$@" apply
touch /var/run/last-cosmos-ok.stamp touch /var/run/last-cosmos-ok.stamp
find /var/lib/puppet/reports/ -type f -mtime +10 | xargs rm -f find /var/lib/puppet/reports/ -type f -mtime +10 -print0 | xargs -0 rm -f
} }
main $* main "$@"
if [ -f /cosmos-reboot ]; then if [ -f /cosmos-reboot ]; then
rm -f /cosmos-reboot rm -f /cosmos-reboot