[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tips: set up your rc file



 
    
set up your rc file:

[root@igloo rc.d]# pwd 
/etc/rc.d

[root@igloo rc.d]# find . -name "*mon*"
./init.d/mon
./rc3.d/S99mon
./rc6.d/K99mon

[root@igloo rc.d]# cd init.d/

[root@igloo init.d]# cat mon
#!/bin/sh

# Startup script for the Monitor server
#
# chkconfig: 36 99 99
#            ^^
#            level 3 & 6; start ID 99; kill ID 99
#
# description: Monitor is a server
#
# processname: mon
# pidfile: /var/run/mon.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

M=/usr/lib/mon

# See how we were called.
case "$1" in
    start)
        echo -n "Starting Moniter: "
        daemon mon -c /etc/mon/mon.cf -a $M/alert.d -s $M/mon.d -f 2>/dev/null
        echo
        ;;
    stop)
        echo -n "Shutting down Moniter: "
        killproc mon
        echo
        ;;
  restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: mon {start|stop|restart}"
        exit 1
esac

exit 0


run ntsysv can display and set daemon "mon"

Google