summaryrefslogtreecommitdiffstats
path: root/satellit_installer/static_files/slxadmin/opt/openslx/slxadmin-cronscript
blob: 9ff600b6c292a212e09840b4d40b1befb64ac1c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

PIDFILE="/tmp/bwlp-cronphppid"
OLDPID=
[ -s "$PIDFILE" ] && OLDPID=$(cat "$PIDFILE")

[ -n "$OLDPID" ] && kill -0 "$OLDPID" && exit 0

echo $$ > "$PIDFILE"

FILE=$(mktemp)
if ! timeout -k 3 60 php /srv/openslx/www/slx-admin/api.php cron >"$FILE" 2>&1; then
	php /srv/openslx/www/slx-admin/api.php cron --crashreport "$FILE"
fi
rm -f -- "$FILE" "$PIDFILE"
exit 0