-
Notifications
You must be signed in to change notification settings - Fork 0
/
ident-me-lua
executable file
·62 lines (53 loc) · 1.35 KB
/
ident-me-lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
set -e
### BEGIN INIT INFO
# Provides: moncak
# Required-Start: $syslog $remote_fs $network $local_fs
# Required-Stop: $syslog $remote_fs $network $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start ident-me-lua by moncak
# Description:
# starts ident-me-lua
### END INIT INFO
NAME=ident-me-lua
DAEMON="/usr/bin/lua5.4" # 其它版本理论上也可以,但是我还没测试
DAEMON_OPTS="/path/to/ident_me.lua" # 你的脚本路径
PIDFILE="/var/run/ident-me-lua.pid"
DESC="ident-me service by moncak"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
do_start() {
log_daemon_msg "Starting $DESC" $NAME
start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE --background --make-pidfile --startas $DAEMON -- $DAEMON_OPTS
log_end_msg $?
}
do_stop() {
log_daemon_msg "Stopping $DESC" $NAME
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON --pidfile $PIDFILE
log_end_msg $?
}
do_status() {
status_of_proc -p $PIDFILE $DAEMON $NAME
}
#do_restart() {
# $0 stop && sleep 1 && $0 start
#}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
status)
do_status
;;
# restart)
# do_restart
# ;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|status}"
exit 1
;;
esac