#!/bin/sh # # cron job admin script for WebMeter # # $Id: webmeter6.frm,v 1.5 1996/05/01 09:03:06 kenmcd Exp $ TRACE=false # make true to enable tracing MYTITLE="pmlogger crontab Administration for Host `hostname`" # load common procedures . ./webmetercommon.cgi # get current settings # _current() { if grep '^[^#].*cron.pmcheck' $CRONTAB >/dev/null 2>&1 then : else check=false check_yes= check_no=checked fi if grep '^[^#].*cron.pmdaily' $CRONTAB >/dev/null 2>&1 then xxx=`sed -n <$CRONTAB -e '/^[^#].*cron.pmdaily/{ s/.*-k *// s/ .*// p }'` [ "X$xxx" != X ] && keep_in=$xxx else daily=false daily_yes= daily_no=checked fi } # restore sane defaults # _default() { check=true check_yes=checked check_no= daily=true daily_yes=checked daily_no= keep_in=7 keep=7 } # do default page set up # _home() { _preamble "$MYTITLE" cat <

The performance archives managed by the pmlogger utility may benefit from some period management tasks, run as root by cron.

The check task periodically interrogates all configured pmlogger instances and restarts any that are not currently running.

The archive management task is run once a day to start a new archive for each configured pmlogger instance and to cull old archives.

Enable periodic checking? Yes No
Enable daily archive management? Yes No
Keep archives for ... days


Display man pages: cron.pmcheck, cron.pmdaily. End-of-File _postscript } # mainline # _form _decode_params check daily keep action if [ "$action" = "Cancel" ] then echo "Location: webmeter0.cgi" echo exit fi if [ "$action" = Help ] then echo "Location: http://$SERVER_NAME:$SERVER_PORT/pcpweb/custom.html#Sample-cron-scripts" echo exit fi [ "$action" = Defaults ] && _default # Ok or defaults or \n in last input widget echo 'g/cron.pmcheck/d' >$tmp.cmd echo 'g/cron.pmdaily/d' >>$tmp.cmd rm -f $tmp.tmp; touch $tmp.tmp $check && echo "25,55 * * * * /usr/pcp/pmlogger/cron.pmcheck" >>$tmp.tmp if $daily then if [ "X$keep" = X ] then _yywarn "Keep must be non-blank to enable the daily archive management task." "$MYTITLE" exit fi if echo "$keep" | grep '[^0-9]' >/dev/null then _yywarn "Keep must be numeric and non-negative to enable the daily archive management task." "$MYTITLE" exit fi echo "10 0 * * * /usr/pcp/pmlogger/cron.pmdaily -k $keep" >>$tmp.tmp fi if [ -s $tmp.tmp ] then echo '$a' >>$tmp.cmd cat $tmp.tmp >>$tmp.cmd echo '.' >>$tmp.cmd fi echo w >>$tmp.cmd echo q >>$tmp.cmd ex - $CRONTAB <$tmp.cmd killall -HUP cron exec `pwd`/webmeter6.cgi