blob: c59cd402f4ed194d6bc9efd5417a3644570f8d64 (
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
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: zetacoin
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# zetacoin_enable (bool): Set to NO by default.
# Set it to YES to enable zetacoin.
# zetacoin_config (path): Set to %%PREFIX%%/etc/zetacoin.conf
# by default.
# zetacoin_datadir (str): Default to "/var/db/zetacoin"
# Base data directory.
. /etc/rc.subr
name=zetacoin
rcvar=zetacoin_enable
: ${zetacoin_enable:=NO}
: ${zetacoin_config=%%PREFIX%%/etc/zetacoin.conf}
: ${zetacoin_datadir=/var/db/zetacoin}
required_files=${zetacoin_config}
command=%%PREFIX%%/bin/zetacoind
zetacoin_chdir=${zetacoin_datadir}
pidfile="${zetacoin_datadir}/zetacoind.pid"
stop_cmd=zetacoin_stop
command_args="-conf=${zetacoin_config} -datadir=${zetacoin_datadir} -noupnp -daemon -pid=${pidfile}"
start_precmd="${name}_prestart"
zetacoin_create_datadir()
{
echo "Creating data directory"
eval mkdir -p ${zetacoin_datadir}
}
zetacoin_prestart()
{
if [ ! -d "${zetacoin_datadir}/." ]; then
zetacoin_create_datadir || return 1
fi
}
zetacoin_requirepidfile()
{
if [ ! "0`check_pidfile ${pidfile} ${command}`" -gt 1 ]; then
echo "${name} not running? (check $pidfile)."
exit 1
fi
}
zetacoin_stop()
{
zetacoin_requirepidfile
if checkyesno ${rcvar}; then
echo "Stopping ${name}."
eval ${command} -conf=${zetacoin_config} -datadir=${zetacoin_datadir} stop
wait_for_pids ${pidfile}
fi
}
load_rc_config $name
run_rc_command "$1"
|