Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 58a5ede102e1d98b5f21bc2102c4b730 > files > 9

fcron-3.0.5-1.fc14.src.rpm

#! /bin/bash

pid_file=$1
[ "z$pid_file" = 'z' ] && pid_file=/var/run/fcron_watch_config.pid

echo $$ > $pid_file

trap ':' TERM

while true; do
 fcron_config_modified &
 notifypid=$!
 wait $notifypid
 notifyres=$?
 
 if [ z"$notifyres" = 'z0' ]; then :
  # some change in th econfig files
 elif [ z"$notifyres" = 'z1' ]; then
  # some error happened
  exit 1
 else
  # a signal was received, kill notification. Could verify that $notifyres > 128.
  kill -TERM $notifypid
  exit 0
 fi

 check_system_crontabs &
 checkpid=$!
 wait $checkpid
 checkres=$?
 # a signal was rececived. Kill the process without waiting for 30 sec.
 # in fact the TERM is trap'ed, and during a sleep (in check_system_crontabs)
 # it seems that the sleep isn't interrupted, but at least the main script
 # is stopped and upon waking from the sleep check_system_crontabs should
 # only do cleanup.
 if [ $checkres -gt 128 ]; then
  kill -TERM $checkpid
  exit 0
 fi
done

# should never go here.