Hi I am trying to get fetchmail to run as a daemon from an init script. The script is below:
#!/bin/sh # # fetchmail This shell script takes care of starting and stopping # the fetchmail DAEMON. # # # chkconfig: 2345 95 5 # description: fetchmail fetchs mail from pop3/imap mail servers # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -f /usr/bin/fetchmail ] || exit 0 [ -f /etc/fetchmail.conf ] || exit 0 # See how we were called. case "$1" in start) # Start daemons. echo -n "Starting fetchmail: " daemon /usr/bin/fetchmail -d 1 --syslog -f /etc/fetchmail.conf echo touch /var/lock/subsys/fetchmail ;; stop) # Stop daemons. echo -n "Shutting down fetchmail: " /usr/bin/fetchmail -q --syslog echo rm -f /lock/subsys/fetchmail ;; restart) $0 stop $0 start ;; status) status fetchmail ;; *) echo "Usage: fetchmail {start|stop|restart|status}" exit 1 esac exit 0 this script seems to work except that how do i get it not to output the following to the command line "fetchmail: background fetchmail at 3419 killed." when the script is shutting fetchmail down. Also is this the best way of creating this script? Thankyou Charlie
fetchmail
Description: Binary data