Ubuntu/Debian Nginx init.d script

  • 1

holla ,

ini kalo ente install nginx from source , biasanya males toh mesti ke /usr/local/nginx/sbin/nginx kalo mau nyalain,reload,atau mau test config nginx pake ini aja broh buat ente yang biasanya jalanin serpis via init script.


#!/bin/sh

#This is a start script for nginx. Tested on Unbuntu Edge. 
#Should work on Ubuntu, Debian and probably a few other Linux distros.
#Change DAEMON and CONFIG_FILE  if neccessary

PATH=/sbin:/bin:/usr/sbin:/usr/bin


#Location of nginx binary. Change path as neccessary
DAEMON=/usr/local/nginx/sbin/nginx
#Location of configuration file. Change path as neccessary
CONFIG_FILE=/usr/local/nginx/conf/nginx.conf


DAEMON_OPTS="-c $CONFIG_FILE"
NAME=nginx
DESC="nginx web server"
PIDFILE=/var/run/$NAME.pid 
SCRIPTNAME=/etc/init.d/$NAME


#only run if binary can be found
test -x $DAEMON || exit 0

set -e

#import init-functions
. /lib/lsb/init-functions

case "$1" in
start)
log_daemon_msg "Starting $DESC" $NAME
if ! start-stop-daemon --start --quiet\
    --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
    log_end_msg 1
    else
    log_end_msg 0
fi
;;
stop)
log_daemon_msg "Stopping $DESC" $NAME
if start-stop-daemon --quiet --stop --oknodo --retry 30\
    --pidfile $PIDFILE --exec $DAEMON; then
    rm -f $PIDFILE
    log_end_msg 0
    else
    log_end_msg 1
fi
;;
reload)
log_daemon_msg "Reloading $DESC configuration" $NAME
if start-stop-daemon --stop --signal 2 --oknodo --retry 30\
    --quiet --pidfile $PIDFILE --exec $DAEMON; then
    if start-stop-daemon --start --quiet  \
        --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
        log_end_msg 0
        else
        log_end_msg 1
    fi
    else
    log_end_msg 1
fi
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac

exit 0

udah gak usah malu-malu dan sok pro dah , ini berguna juga kok buat hemat waktu manage serpis nginx

BR,
obet

1 comment:

  1. The program will choose five completely different numbers on every reel at the moment when the participant spins the wheel. All potential prizes are added to stability immediately and mechanically. This course of is the same each for players who are playing in} with real cash or simply utilizing free spins. Video 다파벳 slots are unique outcome of|as a result of} they can characteristic a large number of reel sizes and paylines (some video games characteristic a lot as} 100!).

    ReplyDelete