#!/bin/sh -

if [ -r /etc/defaults/periodic.conf ]; then
	. /etc/defaults/periodic.conf
	source_periodic_confs
fi

rc=0

case "${daily_ampache_gc_enable:-no}" in
[Nn][Oo])
	;;
*)
	phpcmd=%%LOCALBASE%%/bin/php
	cronscript="%%WWWDIR%%/bin/cli run:cronProcess"

	if ! su -m %%WWWOWN%% -c "$phpcmd $cronscript" >/dev/null 2>&1 ; then
		echo 'ampache cron script failed- try running it manually'
		echo "# $phpcmd $cronscript"
		rc=2
	fi
	;;
esac

exit $rc
