mirror of
https://github.com/PGYER/codefever.git
synced 2026-05-07 22:18:21 +08:00
* fix(Useless Code): remove useless code * feat(Deploy Scripts): add deploy scripts * fix(Delopy Script): change settings * fix(Deploy Script): fix ssh-keygen script * fix(Deploy Script): change env file path * feat(Deploy Script): add db migration * fix(Deploy script): change script * feat(Deploy Script): add sql file to create database * fix(Deploy Script): add composer support * fix(Deploy Script): add composer * fix(Service Script): add http gateway * fix(Deploy Script): add git path * fix(Deploy Script): fix setting bugs * fix(Init Script): get user from config * fix(Service): adjust run users * feat(Doc): add doc * fix(Doc): change docs * fix(Deploy script): change owner of storage path * feat: codefever-community documentation system * fix(Doc): doc details page style * feat: fix page navigation * fix(SQL File): fix db file fit MySQL 5.7 * fix(FileTree): empty repository display * fix: fix helper navigation * docs(zh-cn essential part): * fix(Doc Style): change markdown.css * docs(contribution doc): * fix: unified page style * docs(Readme): add readme * build(Build): Co-authored-by: cubic <carneywu@pgyer.com> Co-authored-by: pololi <pololi@pgyer.com> Co-authored-by: yangchen <chenyang@pgyer.com>
109 lines
2.0 KiB
Bash
Executable File
109 lines
2.0 KiB
Bash
Executable File
#! /bin/bash
|
|
# chkconfig: 2345 55 25
|
|
# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and
|
|
# run 'update-rc.d -f nginx defaults', or use the appropriate command on your
|
|
# distro. For CentOS/Redhat run: 'chkconfig --add nginx'
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: nginx
|
|
# Required-Start: $all
|
|
# Required-Stop: $all
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: starts the nginx web server
|
|
# Description: starts nginx using start-stop-daemon
|
|
### END INIT INFO
|
|
|
|
# Author: ezhttp
|
|
# website: http://lnmp.org
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
DESC="nginx daemon"
|
|
nginx_location=/usr/local/nginx
|
|
DAEMON=$nginx_location/sbin/nginx
|
|
CONFIGFILE=$nginx_location/conf/nginx.conf
|
|
PIDFILE=$nginx_location/logs/nginx.pid
|
|
SCRIPTNAME=/etc/init.d/nginx
|
|
|
|
set -e
|
|
[ -x "$DAEMON" ] || exit 0
|
|
|
|
acqNginxPid(){
|
|
local pid
|
|
if [ -f $PIDFILE ] ; then
|
|
pid=`cat $PIDFILE`
|
|
fi
|
|
|
|
if [[ -d /proc/${pid} ]]; then
|
|
echo ${pid}
|
|
fi
|
|
}
|
|
|
|
do_start() {
|
|
local pid=`acqNginxPid`
|
|
if [[ ".${pid}" == "." ]] ; then
|
|
$DAEMON -c $CONFIGFILE
|
|
else
|
|
echo -n "nginx already running"
|
|
fi
|
|
}
|
|
|
|
do_stop() {
|
|
local pid=`acqNginxPid`
|
|
if [ ".${pid}" != "." ] ; then
|
|
kill -INT ${pid}
|
|
for i in {1..10};do
|
|
echo "waiting nginx stop..."
|
|
sleep 1
|
|
if [[ ! -d /proc/${pid} ]]; then
|
|
echo "nginx stopped done."
|
|
return 0
|
|
fi
|
|
done
|
|
echo "nginx stopped failed."
|
|
exit 1
|
|
else
|
|
echo -n "nginx not running"
|
|
fi
|
|
}
|
|
|
|
do_reload() {
|
|
local pid=`acqNginxPid`
|
|
if [ ".${pid}" != "." ] ; then
|
|
kill -HUP ${pid}
|
|
else
|
|
echo -n "nginx can't reload"
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
echo -n "Starting $DESC: $NAME"
|
|
do_start
|
|
echo "."
|
|
;;
|
|
stop)
|
|
echo -n "Stopping $DESC: $NAME"
|
|
do_stop
|
|
echo "."
|
|
;;
|
|
reload|graceful)
|
|
echo -n "Reloading $DESC configuration..."
|
|
do_reload
|
|
echo "."
|
|
;;
|
|
restart)
|
|
echo -n "Restarting $DESC: $NAME"
|
|
do_stop
|
|
do_start
|
|
echo "."
|
|
;;
|
|
*)
|
|
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
|
|
exit 3
|
|
;;
|
|
esac
|
|
|
|
exit 0
|
|
|