Feb 25, 2020
This commit is contained in:
44
configs/usr/local/etc/rc.d/gstat_exporter
Executable file
44
configs/usr/local/etc/rc.d/gstat_exporter
Executable file
@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2018-2020, diyIT.org
|
||||
# All rights reserved.
|
||||
#
|
||||
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
|
||||
# https://diyit.org/license/
|
||||
#
|
||||
#
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
# 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.6 /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"
|
Reference in New Issue
Block a user