## $Revision: 1.3 $ ## innwatch.ctl -- control file for innwatch. ## Indicates what to run to test the state of the news system, and what ## to do about it. Format: ## !state!when!command!test!limit!command!reason/comment ## where ## Delimiter; pick from [,:@;?!] ## State to enter if true. ## States we must be in to match. ## Command to run to test condition. ## Operator to use in test(1) command. ## Value to test against. ## Command for innwatch to perform; use exit, ## flush, go, pause, shutdown, skip, or throttle. ## Used in ctlinnd command (if needed). ## First, just exit innwatch if innd has gone away. ## =()@ && echo 0 || echo 1 ! eq ! 1 ! exit ! innd dead>()= !!! test -f /usr/lib/news/innd/innd.pid && echo 0 || echo 1 ! eq ! 1 ! exit ! innd dead ## Next test the load average. Above first threshold pause, above higher ## threshold throttle, below restart limit undo whatever was done. ## =()@ ! go ! loadav>()= !load!load hiload! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! lt ! 1000 ! go ! loadav ## =()@ ! throttle ! loadav>()= !hiload!+ load! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! 2000 ! throttle ! loadav ## =()@ ! pause ! loadav>()= !load!+! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! 1500 ! pause ! loadav ## If load is OK, check space (and inodes) on various filesystems ## =()@ ! throttle ! No space (spool)>()= !!! df . | awk 'NR == 2 { print $4 }' ! lt ! 2000 ! throttle ! No space (spool) ## =()@ | awk 'NR == 2 { print $4 }' ! lt ! @@ ! throttle ! No space (newsq)>()= !!! df /usr/spool/news/out.going | awk 'NR == 2 { print $4 }' ! lt ! 800 ! throttle ! No space (newsq) ## =()@ | awk 'NR == 2 { print $4 }' ! lt ! @@ ! throttle ! No space (newslib)>()= !!! df /usr/lib/news | awk 'NR == 2 { print $4 }' ! lt ! 3000 ! throttle ! No space (newslib) ## =()@ ! throttle ! No space (spool inodes)>()= !!! df -i . | awk 'NR == 2 { print $3 }' ! lt ! 200 ! throttle ! No space (spool inodes)