blob: 32e0d2a2ea59d8e8906bd1bdb34a464953f16fe0 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dnetc
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable dnetc:
# dnetc_enable (bool): Set to "NO" by default.
# Set to "YES" to enable dnetc.
# dnetc_dir (path): Set to "%%BINDIR%%" by default.
# dnetc_user (user): Set to "%%CLIENTUSER%%" by default.
#
. %%RC_SUBR%%
name="dnetc"
rcvar=`set_rcvar`
load_rc_config $name
: ${dnetc_enable="NO"}
: ${dnetc_dir="%%BINDIR%%"}
: ${dnetc_user="%%CLIENTUSER%%"}
required_files=${dnetc_dir}/${name}.ini
start_cmd="${name}_start"
stop_cmd="${name}_stop"
extra_commands="flush fetch update"
flush_cmd="${name}_flush"
fetch_cmd="${name}_fetch"
update_cmd="${name}_update"
dnetc_start()
{
if ps -x -o ucomm -U${dnetc_user} | grep ${name} >/dev/null; then
echo "${name} already running?"
else
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -quiet" >/dev/null 2>&1
echo -n " ${name}"
fi
}
dnetc_stop()
{
if ps -x -o ucomm -U${dnetc_user} | grep ${name} >/dev/null; then
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -shutdown" >/dev/null 2>&1
# wait for dnetc to stop
sleep 2
echo -n " ${name}"
else
echo "${name} not running?"
fi
}
dnetc_flush()
{
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -flush" >/dev/null 2>&1
}
dnetc_fetch()
{
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -fetch" >/dev/null 2>&1
}
dnetc_update()
{
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -update" >/dev/null 2>&1
}
run_rc_command "$1"
|