Skip to content
Newer
Older
100644 134 lines (108 sloc) 3.57 KB
dcc3217 @klacke ""
authored May 7, 2003
1 #! /bin/sh
2
3
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored May 26, 2003
4 YAWS_BIN=%prefix%bin/yaws
47b4eec @klacke made the default --id to be deafult
authored Dec 29, 2007
5
6 ## By default we run with the default id
7 # YAWS_ID_OPTS=--id myserverid
8
d983f7d @klacke prepare for 1.82
authored May 28, 2009
9 conf="--conf %etcdir%yaws/yaws.conf"
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored May 26, 2003
10
11 test -x $YAWS_BIN || exit 5
12
dcc3217 @klacke ""
authored May 7, 2003
13
14
15 # Shell functions sourced from /etc/rc.status:
16 # rc_check check and set local and overall rc status
17 # rc_status check and set local and overall rc status
18 # rc_status -v ditto but be verbose in local rc status
19 # rc_status -v -r ditto and clear the local rc status
20 # rc_failed set local and overall rc status to failed
21 # rc_failed <num> set local and overall rc status to <num><num>
22 # rc_reset clear local rc status (overall remains)
23 # rc_exit exit appropriate to overall rc status
24 # rc_active checks whether a service is activated by symlinks
25 . /etc/rc.status
26
27 # First reset status of this service
28 rc_reset
29
30 # Return values acc. to LSB for all commands but status:
31 # 0 - success
32 # 1 - generic or unspecified error
33 # 2 - invalid or excess argument(s)
34 # 3 - unimplemented feature (e.g. "reload")
35 # 4 - insufficient privilege
36 # 5 - program is not installed
37 # 6 - program is not configured
38 # 7 - program is not running
39 #
40 # Note that starting an already running service, stopping
41 # or restarting a not-running service as well as the restart
42 # with force-reload (in case signalling is not supported) are
43 # considered a success.
44
45 case "$1" in
46 start)
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored May 26, 2003
47 echo -n "Starting YAWS"
dcc3217 @klacke ""
authored May 7, 2003
48 ## Start daemon with startproc(8). If this fails
49 ## the echo return value is set appropriate.
50
51 # NOTE: startproc returns 0, even if service is
52 # already running to match LSB spec.
47b4eec @klacke made the default --id to be deafult
authored Dec 29, 2007
53 startproc $YAWS_BIN --daemon --heart ${YAWS_ID_OPTS} ${conf}
dcc3217 @klacke ""
authored May 7, 2003
54
55 # Remember status and be verbose
56 rc_status -v
57 ;;
58 stop)
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored May 26, 2003
59 echo -n "Shutting down YAWS"
dcc3217 @klacke ""
authored May 7, 2003
60 ## Stop daemon with killproc(8) and if this fails
61 ## set echo the echo return value.
62
47b4eec @klacke made the default --id to be deafult
authored Dec 29, 2007
63 startproc $YAWS_BIN --stop ${YAWS_ID_OPTS}
dcc3217 @klacke ""
authored May 7, 2003
64
65 # Remember status and be verbose
66 rc_status -v
67 ;;
68 try-restart)
69 ## Stop the service and if this succeeds (i.e. the
70 ## service was running before), start it again.
71 ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
72 $0 status >/dev/null && $0 restart
73
74 # Remember status and be quiet
75 rc_status
76 ;;
77 restart)
78 ## Stop the service and regardless of whether it was
79 ## running or not, start it again.
80 $0 stop
81 $0 start
82
83 # Remember status and be quiet
84 rc_status
85 ;;
86 force-reload)
87 ## Signal the daemon to reload its config. Most daemons
88 ## do this on signal 1 (SIGHUP).
89 ## If it does not support it, restart.
90
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored May 26, 2003
91 echo -n "Force Reload service YAWS"
dcc3217 @klacke ""
authored May 7, 2003
92 ## if it supports it:
47b4eec @klacke made the default --id to be deafult
authored Dec 29, 2007
93 $YAWS_BIN ${YAWS_ID_OPTS} --hup
dcc3217 @klacke ""
authored May 7, 2003
94 rc_status -v
95
96 ;;
97 reload)
98 ## Like force-reload, but if daemon does not support
99 ## signalling, do nothing (!)
100
101 # If it supports signalling:
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored May 26, 2003
102
47b4eec @klacke made the default --id to be deafult
authored Dec 29, 2007
103 startproc $YAWS_BIN ${YAWS_ID_OPTS} --hup
dcc3217 @klacke ""
authored May 7, 2003
104 rc_status -v
105
106 ;;
107 status)
108 echo -n "Checking for service FOO: "
109 ## Check status with checkproc(8), if process is running
110 ## checkproc will return with exit status 0.
111
112 # Return value is slightly different for the status command:
113 # 0 - service running
114 # 1 - service dead, but /var/run/ pid file exists
115 # 2 - service dead, but /var/lock/ lock file exists
116 # 3 - service not running
117
118 # NOTE: checkproc returns LSB compliant status values.
47b4eec @klacke made the default --id to be deafult
authored Dec 29, 2007
119 checkproc $YAWS_BIN ${YAWS_ID_OPTS} --status
dcc3217 @klacke ""
authored May 7, 2003
120 rc_status -v
121 ;;
122 probe)
123 ## Optional: Probe for the necessity of a reload,
124 ## print out the argument which is required for a reload.
125
126 test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload
127 ;;
128 *)
129 echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
130 exit 1
131 ;;
132 esac
133 rc_exit
Something went wrong with that request. Please try again.