FreeBSD/configs/usr/local/etc/rc.d/gstat_exporter

45 lines
862 B
Plaintext
Raw Normal View History

2020-05-26 21:15:31 -07:00
#!/bin/sh
2020-02-25 11:28:31 -08:00
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
# the two lines below are not just comments but required by rcorder; service -e
# PROVIDE: gstat_exporter
# REQUIRE: NETWORKING DAEMON
. /etc/rc.subr
: ${gstat_exporter_enable="NO"}
name=gstat_exporter
rcvar=${name}_enable
2020-05-26 21:15:31 -07:00
GSTATEXPORTER="nohup /usr/local/bin/python3.7 /root/FreeBSD/scripts/gstat_exporter.py"
2020-02-25 11:28:31 -08:00
start_cmd="${name}_start"
stop_cmd="${name}_stop"
restart_cmd="${name}_restart"
gstat_exporter_start()
{
$GSTATEXPORTER &
}
gstat_exporter_stop()
{
ps ax | grep -ie gstat_exporter.py | grep -v grep | awk '{print $1}' | xargs kill -9
}
gstat_exporter_restart()
{
gstat_exporter_stop
gstat_exporter_start
}
load_rc_config ${name}
run_rc_command "$1"