1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-08-23 20:18:14 +02:00

scripts: move template files to "templates" directory

This commit is contained in:
Henrik Hautakoski 2020-06-11 14:13:07 +02:00
parent 00d96cf045
commit c5a8f20c04
7 changed files with 5 additions and 5 deletions

7
scripts/templates/config Normal file
View file

@ -0,0 +1,7 @@
# Default settings for {{ PACKAGE_NAME }}
#
# This is sourced by the systemd unit file.
# Command line flags to pass to {{ PACKAGE_NAME }}
# First is IP to listen to, second is port.
#OPTS="127.0.0.1 1337"

View file

@ -0,0 +1,9 @@
{{ LOG_FILE }} {
daily
dateext
dateformat _%Y-%m-%d
rotate 10
compress
notifempty
copytruncate
}

47
scripts/templates/rc.conf Normal file
View file

@ -0,0 +1,47 @@
#!/bin/sh
#
# Add the following lines to /etc/rc.conf to configure eosio_api_healthcheck:
#
# eosio_api_healthcheck_args : arguments to the command.
#
# eosio_api_healthcheck_logfile : file to log to (default /var/log/${name}.log)
#
# PROVIDE: {{ RC_NAME }}
# REQUIRE: netif FILESYSTEMS
. /etc/rc.subr
name="{{ RC_NAME }}"
desc="{{ DESCRIPTION }}"
command="{{ PROGRAM }}"
command_args="${eosio_api_healthcheck_args}"
logfile="${eosio_api_healthcheck_logfile:-/var/log/${name}.log}"
pidfile="/var/run/${name}.pid"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
eosio_api_healthcheck_start()
{
echo "Starting ${name}"
${command} ${command_args} >${logfile} 2>&1 &
echo $! > ${pidfile}
}
eosio_api_healthcheck_stop()
{
rc_pid=$(check_pidfile ${pidfile} ${command})
if $rc_pid; then
rc_pid=$(cat ${pidfile})
kill -$sig_stop $rc_pid
wait_for_pids $rc_pid
else
_run_rc_notrunning
return 1
fi
}
load_rc_config $name
run_rc_command "$1"

View file

@ -0,0 +1,5 @@
if $programname == '{{ PROGRAM }}' then {
{{ LOG_FILE }}
stop
}

View file

@ -0,0 +1,12 @@
[Unit]
Description={{ DESCRIPTION }}
After=network.target
[Service]
EnvironmentFile=-/etc/{{ PACKAGE_NAME }}/env
Type=simple
ExecStart={{ PROGRAM }} $OPTS
Restart=on-failure
[Install]
WantedBy=multi-user.target