?
Current Path : /proc/thread-self/root/etc/rc4.d/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : //proc/thread-self/root/etc/rc4.d/S12nxlog |
#!/bin/sh # /etc/init.d/nxlog: start the nxlog daemon. # nxlog: Starts the nxlog daemon # # chkconfig: 2345 12 78 # description: nxlog is a logging daemon # processname: /usr/bin/nxlog # config: /etc/nxlog.conf ### BEGIN INIT INFO # Provides: $syslog # Required-Start: $network $local_fs # Required-Stop: $network $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: logging daemon ### END INIT INFO #TODO: lockfile PATH=/bin:/usr/bin:/sbin:/usr/sbin pidfile=/var/run/nxlog/nxlog.pid nxlog=/usr/bin/nxlog test -f $nxlog || exit 5 . /etc/init.d/functions RETVAL=0 case "$1" in start) echo "Starting nxlog daemon..." umask 0022 if ! [ -d /var/run/nxlog ]; then mkdir /var/run/nxlog chown nxlog:nxlog /var/run/nxlog chmod 1770 /var/run/nxlog fi # get the status $0 status >/dev/null my_stat=$? # if already running if [ $my_stat -eq 0 ]; then echo "nxlog is already running" RETVAL=1 # try to start in all other cases else $nxlog if [ $? -eq 0 ]; then RETVAL=0 echo "nxlog started!" else RETVAL=1 echo "Failed to start nxlog!" fi fi ;; stop) echo "Stopping nxlog daemon..." # get the status $0 status >/dev/null my_stat=$? # do nothing if not running if [ $my_stat -eq 3 ]; then RETVAL=7 echo "nxlog is not running" # try to stop in any other cases else $nxlog -s if [ $? -eq 0 ]; then RETVAL=0 echo "nxlog stopped" else RETVAL=1 echo "Failed to stop nxlog" fi fi ;; reload) echo "Reloading nxlog daemon..." # get the status $0 status >/dev/null my_stat=$? # return 7 if not running if [ $my_stat -eq 3 ]; then RETVAL=7 echo "nxlog is not running" # in all other cases try to reload else $nxlog -r if [ $? -eq 0 ]; then RETVAL=0 echo "nxlog reloaded" else RETVAL=1 echo "Failed to reload nxlog" fi fi ;; status) # if running fine if [ -f $pidfile ] && ps $(<$pidfile) >/dev/null; then RETVAL=0 echo "nxlog is running" # if pidfile exists, but not running elif [ -f $pidfile ]; then RETVAL=1 echo "nxlog is not running but pidfile exists" # running, but no pidfile, return value not defined elif [ ! -f $pidfile ] && ps aux | grep -v grep | grep -q $nxlog; then RETVAL=4 echo "nxlog is running, but no pidfile exists" # not running, and no pidfile else RETVAL=3 echo "nxlog is not running" fi ;; restart|force-reload) echo "Restarting nxlog daemon..." # get the current status $0 status >/dev/null my_stat=$? # if not running if [ $my_stat -eq 3 ]; then $0 start if [ $? -eq 0 ]; then echo "nxlog restarted" RETVAL=0 else echo "Failed to restart nxlog" RETVAL=1 fi # if running, or unknown status elif [ $my_stat -eq 0 ] || [ $my_stat -eq 4 ]; then $0 stop || exit 1 $0 start if [ $? -eq 0 ]; then echo "nxlog restarted" RETVAL=0 else echo "Failed to restart nxlog" RETVAL=1 fi # if dead and pidfile exists elif [ $my_stat -eq 1 ]; then rm -rf $pidfile $0 start if [ $? -eq 0 ]; then echo "nxlog restarted" RETVAL=0 else echo "Failed to restart nxlog" RETVAL=1 fi fi ;; *) failure "Usage: /etc/init.d/nxlog {start|stop|status|restart|force-reload}" exit 1 esac exit $RETVAL