Command-line switch for PHP Binary and Verbosity

This will fix #429
This commit is contained in:
Sebastian Grewe 2013-07-11 16:07:51 +02:00
parent bbcb210f27
commit 450cc4d24d

View File

@ -15,9 +15,6 @@ PIDFILE='/tmp/mmcfe-ng-cron.pid'
# List of cruns to execute
CRONS="findblock.php proportional_payout.php pplns_payout.php pps_payout.php blockupdate.php auto_payout.php tickerupdate.php notifications.php statistics.php archive_cleanup.php"
# Additional arguments to pass to cronjobs
CRONARGS="-v"
# Output additional runtime information
VERBOSE="0"
@ -27,6 +24,20 @@ VERBOSE="0"
# #
################################################################
# Overwrite some settings via command line arguments
while getopts "hvp:" opt; do
case "$opt" in
h|\?)
echo "Usage: $0 [-v] [-p PHP_BINARY]";
exit 0
;;
v) VERBOSE=1
;;
p) PHP_BIN=$3; shift;
;;
esac
done
# Find scripts path
if [[ -L $0 ]]; then
CRONHOME=$( dirname $( readlink $0 ) )
@ -70,8 +81,8 @@ fi
echo $PID > $PIDFILE
for cron in $CRONS; do
[[ $VERBOSE == 1 ]] && echo "Running $cron, see output below for details"
$PHP_BIN $cron $CRONARGS
[[ $VERBOSE == 1 ]] && echo "Running $cron, check logfile for details"
$PHP_BIN $cron
done
# Remove pidfile