aboutsummaryrefslogtreecommitdiffstats
path: root/net-p2p/uhub/files/uhub.sh.in
blob: 7f8167b5b497ebcdbc7abf709da6fa193176f276 (plain) (blame)
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
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: uhub
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable uhub:
#
# uhub_enable (bool):   Set it to "YES" to enable uhub
#           Default is "NO".
# uhub_pidfile (path):  Set full path to pid file.
#           Default is "/var/run/uhub.pid".
#

. /etc/rc.subr

name="uhub"
rcvar=`set_rcvar`

load_rc_config $name

: ${uhub_enable:="NO"}
: ${uhub_flags:="-L -u uhub -g uhub"}
: ${uhub_pidfile:="/var/run/${name}.pid"}

command=%%PREFIX%%/bin/uhub
command_args="-f -p ${uhub_pidfile}"
pidfile=${uhub_pidfile}
required_files=${uhub_conf}
stop_postcmd=stop_postcmd
reload_precmd=reload_precmd
reload_postcmd=reload_postcmd
extra_commands="reload"

stop_postcmd()
{
    rm -f ${pidfile}
}

reload_precmd()
{
    echo "Reload ${name} configuration."
}

reload_postcmd()
{
    kill -HUP `cat ${pidfile}`
}

run_rc_command "$1"