check_incoming_leap_second.sh 949 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#!/bin/sh

dotconfig=/wr/etc/dot-config

pBaseName=leapsec
pFullName=wrs_$pBaseName
process=/wr/bin/$pFullName

echo -n "Starting $process  "

if [ -f $dotconfig ]; then
	. $dotconfig
else
	echo "$0 unable to source dot-config ($dotconfig)!"
fi

WRS_LOG=$CONFIG_WRS_LOG_OTHER

# if empty turn it to /dev/null
if [ -z $WRS_LOG ]; then
	WRS_LOG="/dev/null";
fi
# if a pathname, use it
if echo "$WRS_LOG" | grep / > /dev/null; then
	eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
else
	# not a pathname: use verbatim
	eval LOGPIPE=\" 2\>\&1 \| logger -t $pBaseName -p $WRS_LOG\"
fi

# set msg level
if [ ! -z $CONFIG_WRS_LOG_LEVEL_OTHER ]; then
	WRS_MSG_LEVEL=$CONFIG_WRS_LOG_LEVEL_OTHER
	export WRS_MSG_LEVEL
fi

# be carefull with pidof, no running script should have the same name as
# process
if pidof $pFullName  > /dev/null; then
	# Process s already running
	eval echo "Failed (already running?)" $LOGPIPE
else
	eval $process $LOGPIPE \&
	echo "OK"
fi