#!/bin/sh
### BEGIN INIT INFO
# Provides: redsocks
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start redsocks daemon.
### END INIT INFO
SERVICE_NAME=redsocks
SERVICE_PATH=/usr/local/bin/redsocks
SERVICE_PARAM="-c /etc/redsocks.conf"
SERVICE_HOME=/home/pi
SERVICE_USER=pi
SERVICE_PID_FILE=/var/run/${SERVICE_NAME}.pid
start() {
start-stop-daemon --start \
--chdir "${SERVICE_HOME}" \
--chuid "${SERVICE_USER}" \
--user "${SERVICE_USER}" \
-b -m -p "${SERVICE_PID_FILE}" \
--exec ${SERVICE_PATH} -- ${SERVICE_PARAM}
}
stop() {
start-stop-daemon --stop \
--chdir "${SERVICE_HOME}" \
--chuid "${SERVICE_USER}" \
--user "${SERVICE_USER}" \
-p "${SERVICE_PID_FILE}"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
# code to check status of app comes here
# example: status program_name
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
exit 0
简易init.d脚本
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- ```#!/bin/bash # /etc/init.d/MyShell ### BEGIN INIT INFO ...