|
|
发表于 2006-3-9 07:32:30
|
显示全部楼层
奉献上支持chkconfig的脚本:- #!/bin/bash
- #
- # fetchmail This shell script enables the automatic use of fetchmail.
- # Author An Jiangze <gnap.an AT gmail.com>
- #
- # chkconfig: 5 35 62
- #
- # description: fetchmail daemon for automically retrive mails on remote server.
- # processname: fetchmail
- # config: /etc/fetchmailrc
- . /etc/rc.d/init.d/functions
- lockfile=/var/lock/subsys/fetchmail
- RETVAL=0
- start() {
- echo -n "Starting fetchmail..."
- /usr/bin/fetchmail -f /etc/fetchmailrc && touch "$lockfile" && success || failure
- RETVAL=$?
- echo
- }
- stop() {
- echo -n "Stopping fetchmail..."
- killall /usr/bin/fetchmail && rm -f "$lockfile" && success || failure
- RETVAL=$?
- echo
- }
- restart(){
- stop
- sleep 1
- start
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart|force-reload)
- restart
- ;;
- reload)
- ;;
- condrestart)
- [ -f "$lockfile" ] && restart
- ;;
- status)
- if [ -f "$lockfile" ]; then
- echo $"Fetchmail is running."
- RETVAL=0
- else
- echo $"Fetchmail is not running."
- RETVAL=3
- fi
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
- exit 1
- esac
- exit $RETVAL
复制代码 这个脚本使你可以用chkconfig控制fetchmail的自动启动和运行级别。 |
|