45 lines
862 B
Bash
Executable File
45 lines
862 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# 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
|
|
|
|
GSTATEXPORTER="nohup /usr/local/bin/python3.8 /root/FreeBSD/scripts/gstat_exporter.py"
|
|
|
|
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"
|