summaryrefslogtreecommitdiffstats
path: root/satellit_installer/static_files/slxadmin/opt/openslx/slxadmin-cronscript
blob: 7a2aa63f38cba2d96a16bf254326ca5d1ff4e3a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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
cat "$FILE"
rm -f -- "$FILE" "$PIDFILE"
exit 0