Sample sendmail Stop Script for the kitche Service
#!/contrib/bin/perl
#
# /var/adm/ues/bin/kitche_stop_sendmail.pl
#
# This script simply stops sendmail, points /var/spool/mqueue to
# /var/spool/mqueue.backup, and copies sendmail_backup.cf to
# sendmail.cf.
#
$kitche = "kitche";
$mqueue = "/usr/var/spool/mqueue";
$mqueue_primary = "/usr/var/spool/mqueue.primary";
$mqueue_backup = "/usr/var/spool/mqueue.backup";
$sendmail = "/usr/var/adm/sendmail/sendmail.cf";
$sendmail_backup = "/usr/var/adm/sendmail/sendmail_backup.cf";
$kitche_ck = `/usr/sbin/netstat -i | egrep -v 'kitche1|kitche2' | grep $kitche 2> /dev/null`;
chop($host = `/sbin/hostname`);
# Don't bother running script is kitche not on this host
#
die "$kitche not running on $host.\n" if ($kitche_ck eq "");
# stop sendmail so we can change .cf files and the link.
#
`/sbin/init.d/sendmail stop`;
# since this is a stop, change sendmail.cf to the backup file.
#
`/usr/bin/cp -p $sendmail_backup $sendmail`;
# remove the link that points to the primary mqueue.
#
`/usr/bin/rm $mqueue`;
# add the link to the backup mqueue.
#
`/usr/bin/ln -s $mqueue_backup $mqueue`;