Compare commits
3 commits
f3d3e664d7
...
40078e2972
| Author | SHA1 | Date | |
|---|---|---|---|
| 40078e2972 | |||
| 5a4bb12906 | |||
| 7063a03eef |
3 changed files with 17 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Start the dehydrated-wrapper as a daemon, so that it doesn't prevent other cron jobs from running.
|
# Start the dehydrated-wrapper as a daemon, so that it doesn't prevent other cron jobs from running.
|
||||||
|
|
||||||
daemon /opt/sbin/dehydrated-wrapper
|
daemon -N -a 60 -l daemon.err -b daemon.debug -o daemon.info -n dehydrated-wrapper /opt/gitrepos/random-commands.git/dehydrated-wrapper
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,21 @@ SCANDIR="/data/depository"
|
||||||
DBFILE="/data/sites/slackware.uk/files/repository-search/search.db"
|
DBFILE="/data/sites/slackware.uk/files/repository-search/search.db"
|
||||||
RUNAS_GROUP="depository"
|
RUNAS_GROUP="depository"
|
||||||
|
|
||||||
|
# Only allow one copy of the script to run at any time.
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
if [[ "$FLOCK" != "$0" ]]; then
|
||||||
|
# shellcheck disable=SC2093
|
||||||
|
exec env FLOCK="$0" flock -E 10 -e -n "$0" "$0" "$@"
|
||||||
|
ERR="$?"
|
||||||
|
if (( ERR == 10 )); then
|
||||||
|
# File is locked, exit now.
|
||||||
|
exit 0
|
||||||
|
elif (( ERR > 0 )); then
|
||||||
|
printf "%s: %s\\n" "${0##*/}" "flock execution error" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
RAND="$$$RANDOM"
|
RAND="$$$RANDOM"
|
||||||
|
|
||||||
if ionice -c3 nice -n 19 sg "$RUNAS_GROUP" -c "/opt/bin/updatedb -l no -o \"$DBFILE.$RAND\" -U \"$SCANDIR\" >/dev/null 2>&1"; then
|
if ionice -c3 nice -n 19 sg "$RUNAS_GROUP" -c "/opt/bin/updatedb -l no -o \"$DBFILE.$RAND\" -U \"$SCANDIR\" >/dev/null 2>&1"; then
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
#Delay the run for 15 hours (from midnight) and then run at a random time within 3 hours after that.
|
#Delay the run for 15 hours (from midnight) and then run at a random time within 3 hours after that.
|
||||||
sleep $(( 54000 + (RANDOM % 10800) ))
|
sleep $(( 54000 + (RANDOM % 10800) ))
|
||||||
/opt/sbin/dehydrated -c >/dev/null
|
/opt/gitrepos/dehydrated.git/dehydrated -c >/dev/null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue