Skip to content

Commit 5035947

Browse files
committed
sysutils/node_exporter: Ability to change default pidfile location
1 parent 3dcaef2 commit 5035947

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sysutils/node_exporter/files/node_exporter.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# Default is ":9100".
2020
# node_exporter_textfile_dir (string): Set directory that node_exporter will watch
2121
# Default is "/var/tmp/node_exporter".
22+
# node_exporter_pidfile (string): Set location of the node_exporter pidfile
23+
# Default is "/var/run/node_exporter.pid".
2224

2325
. /etc/rc.subr
2426

@@ -33,12 +35,12 @@ load_rc_config $name
3335
: ${node_exporter_args:=""}
3436
: ${node_exporter_listen_address:=":9100"}
3537
: ${node_exporter_textfile_dir:="/var/tmp/node_exporter"}
38+
: ${node_exporter_pidfile:="/var/run/node_exporter.pid"}
3639

3740

38-
pidfile=/var/run/node_exporter.pid
3941
command="/usr/sbin/daemon"
4042
procname="%%PREFIX%%/bin/node_exporter"
41-
command_args="-f -p ${pidfile} -T ${name} \
43+
command_args="-f -p ${node_exporter_pidfile} -T ${name} \
4244
/usr/bin/env ${procname} \
4345
--web.listen-address=${node_exporter_listen_address} \
4446
--collector.textfile.directory=${node_exporter_textfile_dir} \
@@ -48,11 +50,11 @@ start_precmd=node_exporter_startprecmd
4850

4951
node_exporter_startprecmd()
5052
{
51-
if [ ! -e ${pidfile} ]; then
53+
if [ ! -e ${node_exporter_pidfile} ]; then
5254
install \
5355
-o ${node_exporter_user} \
5456
-g ${node_exporter_group} \
55-
/dev/null ${pidfile};
57+
/dev/null ${node_exporter_pidfile};
5658
fi
5759
if [ ! -d ${node_exporter_textfile_dir} ]; then
5860
install \

0 commit comments

Comments
 (0)