1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-05 01:55:52 +00:00
freebsd-ports/net-p2p/zetacoin/files/zetacoin.in
Thomas Zander ab18d9e94d Update to upstream version 0.9.2.7
PR:		206329
Submitted by:	daniel@morante.net (maintainer)
2016-01-24 19:22:38 +00:00

91 lines
2.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: %%PORTNAME%%
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# %%PORTNAME%%_enable (bool): Set to NO by default.
# Set it to YES to enable %%PORTNAME%%.
# %%PORTNAME%%_config (path): Set to %%PREFIX%%/etc/%%PORTNAME%%.conf
# by default.
# %%PORTNAME%%_user: The user account %%PORTNAME%% daemon runs as
# It uses '%%PORTNAME%%' user by default.
# %%PORTNAME%%_group: The group account %%PORTNAME%% daemon runs as
# It uses '%%PORTNAME%%' group by default.
# %%PORTNAME%%_datadir (str): Default to "/var/db/%%PORTNAME%%"
# Base data directory.
. /etc/rc.subr
name=%%PORTNAME%%
rcvar=%%PORTNAME%%_enable
load_rc_config $name
: ${%%PORTNAME%%_enable:=NO}
: ${%%PORTNAME%%_config=%%PREFIX%%/etc/%%PORTNAME%%.conf}
: ${%%PORTNAME%%_datadir=/var/db/%%PORTNAME%%}
: ${%%PORTNAME%%_user="%%PORTNAME%%"}
: ${%%PORTNAME%%_group="%%PORTNAME%%"}
required_files=${%%PORTNAME%%_config}
command=%%PREFIX%%/bin/%%PORTNAME%%d
%%PORTNAME%%_chdir=${%%PORTNAME%%_datadir}
pidfile="${%%PORTNAME%%_datadir}/%%PORTNAME%%d.pid"
stop_cmd=%%PORTNAME%%_stop
command_args="-conf=${%%PORTNAME%%_config} -datadir=${%%PORTNAME%%_datadir} -noupnp -daemon -pid=${pidfile}"
start_precmd="${name}_prestart"
reindex_cmd=%%PORTNAME%%_reindex
extra_commands="reindex"
%%PORTNAME%%_create_datadir()
{
echo "Creating data directory"
eval mkdir -p ${%%PORTNAME%%_datadir}
[ $? -eq 0 ] && chown -R ${%%PORTNAME%%_user}:${%%PORTNAME%%_group} ${%%PORTNAME%%_datadir}
}
%%PORTNAME%%_prestart()
{
if [ ! -d "${%%PORTNAME%%_datadir}/." ]; then
%%PORTNAME%%_create_datadir || return 1
fi
}
%%PORTNAME%%_requirepidfile()
{
if [ ! "0`check_pidfile ${pidfile} ${command}`" -gt 1 ]; then
echo "${name} not running? (check $pidfile)."
exit 1
fi
}
%%PORTNAME%%_stop()
{
%%PORTNAME%%_requirepidfile
echo "Stopping ${name}."
eval ${command} -conf=${%%PORTNAME%%_config} -datadir=${%%PORTNAME%%_datadir} stop
wait_for_pids ${rc_pid}
}
%%PORTNAME%%_reindex()
{
if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
%%PORTNAME%%_stop
fi
echo "Reindexing ${name} blockchain."
command_args="${command_args} -reindex"
eval ${command} ${command_args}
}
run_rc_command "$1"