On Fri, 18 Jan 2002 22:07:41 -0000
"Charlie Grosvenor" <[EMAIL PROTECTED]> implied:

> 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?

Changing this line

> /usr/bin/fetchmail -q --syslog

to this

> /usr/bin/fetchmail -q --syslog > /dev/null 2>&1

should do the trick. It can be done similarly on startup if you're
getting output and don't want it.

-- 
Failure is not an option. It comes bundled with your Microsoft product.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to