Skip to content

Commit 51edc63

Browse files
committed
chore: add example system V init script
1 parent 5f996e6 commit 51edc63

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

conf/systemV/etc/ghfs.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--root /data
2+
--hide lost+found
3+
--access-log /var/log/ghfs/access.log
4+
--error-log /var/log/ghfs/error.log

conf/systemV/etc/init.d/ghfs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/sh
2+
#
3+
# ghfs - Go HTTP File Server
4+
#
5+
# chkconfig: 35 85 15
6+
# description: Go HTTP File Server
7+
# processname: ghfs
8+
# config: /etc/ghfs.conf
9+
10+
# Source function library.
11+
. /etc/rc.d/init.d/functions
12+
13+
# Source networking configuration.
14+
. /etc/sysconfig/network
15+
16+
# Check that networking is up.
17+
[ "$NETWORKING" = "no" ] && exit 0
18+
19+
ghfs="/usr/local/bin/ghfs"
20+
prog=$(basename $ghfs)
21+
22+
start() {
23+
echo -n $"Starting $prog: "
24+
"$ghfs" --config=/etc/ghfs.conf &
25+
retval=$?
26+
[ $retval -eq 0 ] && success || failure
27+
echo
28+
return $retval
29+
}
30+
31+
stop() {
32+
echo -n $"Stopping $prog: "
33+
killproc "$prog"
34+
retval=$?
35+
echo
36+
return $retval
37+
}
38+
39+
restart() {
40+
stop
41+
start
42+
}
43+
44+
_status() {
45+
status $prog
46+
}
47+
48+
_status_q() {
49+
_status > /dev/null 2>&1
50+
}
51+
52+
case "$1" in
53+
start)
54+
_status_q && exit 0
55+
$1
56+
;;
57+
stop)
58+
_status_q || exit 0
59+
$1
60+
;;
61+
restart|reload)
62+
restart
63+
;;
64+
status)
65+
_status
66+
;;
67+
status_q)
68+
_status_q
69+
;;
70+
condrestart|try-restart)
71+
_status_q || exit 7
72+
restart
73+
;;
74+
*)
75+
echo $"Usage: $0 {start|stop|reload|status|restart}"
76+
exit 2
77+
esac

0 commit comments

Comments
 (0)