Properly overwrite PIDPREFIX via command line argument
This commit is contained in:
parent
4c8295edc2
commit
87315238da
@ -16,10 +16,7 @@ CRONS="findblock.php proportional_payout.php pplns_payout.php pps_payout.php blo
|
|||||||
VERBOSE="0"
|
VERBOSE="0"
|
||||||
|
|
||||||
# Prefix to add to PIDFILE name, so it will be unique in a multipool server.
|
# Prefix to add to PIDFILE name, so it will be unique in a multipool server.
|
||||||
# Can be passed as an argument when calling the script "./run-crons.sh prefix"
|
PIDPREFIX=""
|
||||||
# Eg. "./run-crons.sh ltc" / "./run-crons.sh dmd"
|
|
||||||
# or can be harcoded Eg. PIDPREFIX="LTC" / PIDPREFIX="DMD"
|
|
||||||
PIDPREFIX="$1"
|
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# #
|
# #
|
||||||
@ -30,14 +27,11 @@ PIDPREFIX="$1"
|
|||||||
# My own name
|
# My own name
|
||||||
ME=$( basename $0 )
|
ME=$( basename $0 )
|
||||||
|
|
||||||
# Path to PID file, needs to be writable by user running this
|
|
||||||
PIDFILE="/tmp/$PIDPREFIX$ME.pid"
|
|
||||||
|
|
||||||
# Overwrite some settings via command line arguments
|
# Overwrite some settings via command line arguments
|
||||||
while getopts "hvp:" opt; do
|
while getopts "hvp:x:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h|\?)
|
h|\?)
|
||||||
echo "Usage: $0 [-v] [-p PHP_BINARY]";
|
echo "Usage: $0 [-v] [-p PHP_BINARY] [-x PIDPREFIX]";
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
v) VERBOSE=1 ;;
|
v) VERBOSE=1 ;;
|
||||||
@ -46,9 +40,17 @@ while getopts "hvp:" opt; do
|
|||||||
echo "Option -$OPTARG requires an argument." >&2
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
x) PIDPREFIX=$OPTARG ;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Path to PID file, needs to be writable by user running this
|
||||||
|
PIDFILE="/tmp/$PIDPREFIX$ME.pid"
|
||||||
|
|
||||||
# Find scripts path
|
# Find scripts path
|
||||||
if [[ -L $0 ]]; then
|
if [[ -L $0 ]]; then
|
||||||
CRONHOME=$( dirname $( readlink $0 ) )
|
CRONHOME=$( dirname $( readlink $0 ) )
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user