]> git.gir.st - ttxd.git/blob - src/thttpd-2.27/scripts/thttpd.sh
initial code import
[ttxd.git] / src / thttpd-2.27 / scripts / thttpd.sh
1 #!/bin/sh
2 #
3 # thttpd.sh - startup script for thttpd on FreeBSD
4 #
5 # This goes in /usr/local/etc/rc.d and gets run at boot-time.
6 #
7 # Variables available:
8 # thttpd_enable='YES/NO'
9 # thttpd_program='path'
10 # thttpd_pidfile='path'
11 # thttpd_devfs='path'
12 #
13 # PROVIDE: thttpd
14 # REQUIRE: LOGIN FILESYSTEMS
15 # KEYWORD: shutdown
16
17 . /etc/rc.subr
18
19 name='thttpd'
20 rcvar='thttpd_enable'
21
22 load_rc_config "$name"
23
24 # Defaults.
25 thttpd_enable="${thttpd_enable:-'NO'}"
26 thttpd_program="${thttpd_program:-'/usr/local/sbin/thttpd'}"
27 thttpd_pidfile="${thttpd_pidfile:-'/var/run/thttpd.pid'}"
28
29 thttpd_precmd ()
30 {
31 if [ '' != "$thttpd_devfs" ] ; then
32 mount -t devfs devfs "$thttpd_devfs"
33 devfs -m "$thttpd_devfs" rule -s 1 applyset
34 devfs -m "$thttpd_devfs" rule -s 2 applyset
35 fi
36 }
37
38 thttpd_stop ()
39 {
40 kill -USR1 `cat "$pidfile"`
41 }
42
43 command="$thttpd_program"
44 pidfile="$thttpd_pidfile"
45 start_precmd='thttpd_precmd'
46 stop_cmd='thttpd_stop'
47
48 run_rc_command "$1"
Imprint / Impressum