From: Alan T. DeKok Date: Fri, 8 May 2009 22:40:05 +0000 (+0200) Subject: Portability fixes X-Git-Tag: release_2_1_7~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c55f6c92bb9fda0d835e07bb6cea1a6028bda37;p=thirdparty%2Ffreeradius-server.git Portability fixes tail -n is in /usr/xpg4/bin on Solaris. date +%s is *BSD && Linux, but not Solaris. Work around this for now... --- diff --git a/scripts/radwatch.in b/scripts/radwatch.in index 4724a14aacf..0fc1f7801d4 100644 --- a/scripts/radwatch.in +++ b/scripts/radwatch.in @@ -43,6 +43,11 @@ sysconfdir=@sysconfdir@ pid_file=${rundir}/${name}.pid log_file=${logdir}/${name}_safe.log +# +# On Solaris, this should be /usr/xpg4/bin/tail +# +tail=tail + RADIUSD=$sbindir/${name} RADDBDIR=${sysconfdir}/raddb @@ -134,7 +139,9 @@ do # Send mail when the server starts if test "$MAILTO" != "" then - now=`date +"%s"` + # don't print minutes and seconds: cheap way + # of sending email only once an hour. + now=`date +'%a %b %e %H %Y'` restarts=`expr $restarts + 1` # send email the first time it restarts @@ -146,13 +153,13 @@ $name has restarted unexpectedly at $now See $log_file for details. Last 20 lines are: ---------------------------------------------------------------------- -`tail -n 20 $log_file` +`$tail -n 20 $log_file` EOF - $last_email="$now" + last_email="$now" restarts=0 else - # Send email only once every hour. - if test "$now" -gt `expr $last_email + 3600` + # Send email only once every hour (or so) + if test "$now" != "$last_emaiL" then cat | mail -s "ERROR - $name died, restarting.." $MAILTO <> $log_file 2>&1 &" PID=$!