From 0818cce4071b116b37e7aab2b0d3686374fa6d67 Mon Sep 17 00:00:00 2001 From: Bjango Date: Mon, 24 Oct 2016 18:33:24 +1100 Subject: [PATCH] Added boot script examples --- .gitignore | 1 - resource/Makefile.am | 2 +- resource/rc.d/istatserver | 16 ++++++++++++++++ resource/systemd/istatserver.service | 17 +++++++++++++++++ resource/upstart/istatserver.conf | 16 ++++++++++++++++ src/main.cpp | 2 +- 6 files changed, 51 insertions(+), 3 deletions(-) create mode 100755 resource/rc.d/istatserver create mode 100644 resource/systemd/istatserver.service create mode 100644 resource/upstart/istatserver.conf diff --git a/.gitignore b/.gitignore index 47b3f12..5c89a6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ ._* -istatserver config.h config.log config.status diff --git a/resource/Makefile.am b/resource/Makefile.am index 0d4fc8e..e8cfa55 100644 --- a/resource/Makefile.am +++ b/resource/Makefile.am @@ -1,6 +1,6 @@ dist_man_MANS = istatserver.1 istatserver.conf.5 -EXTRA_DIST = istatserver.conf istatserver_generated.conf +EXTRA_DIST = istatserver.conf istatserver_generated.conf systemd upstart rc.d #dist_sysconf_DATA = istatserver.conf diff --git a/resource/rc.d/istatserver b/resource/rc.d/istatserver new file mode 100755 index 0000000..36dc482 --- /dev/null +++ b/resource/rc.d/istatserver @@ -0,0 +1,16 @@ +#!/bin/sh +# + +# PROVIDE: istatserver +# REQUIRE: FILESYSTEMS NETWORKING netif +# KEYWORD: shutdown + +. /etc/rc.subr + +name="istatserver" +command="/usr/local/bin/istatserver" +rcvar="istatserver_enable" +command_args="-d" + +load_rc_config $name +run_rc_command "$1" diff --git a/resource/systemd/istatserver.service b/resource/systemd/istatserver.service new file mode 100644 index 0000000..1e2051c --- /dev/null +++ b/resource/systemd/istatserver.service @@ -0,0 +1,17 @@ +# +# istatserver daemon service unit file +# + +[Unit] +Description=System monitoring daemon for remote monitoring with iStat for iOS or iStat for macOS +Documentation=man:istatserver(1) +After=network.target + +[Service] +ExecStart=/usr/local/bin/istatserver -d +Restart=on-abort +RestartSec=5 +Type=forking + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/resource/upstart/istatserver.conf b/resource/upstart/istatserver.conf new file mode 100644 index 0000000..32911f8 --- /dev/null +++ b/resource/upstart/istatserver.conf @@ -0,0 +1,16 @@ +# istatserver + +description "istatserver daemon" +author "Bjango" + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on shutdown + +expect daemon +expect fork +respawn +respawn limit 99 5 + +script +exec /usr/local/bin/istatserver -d +end script diff --git a/src/main.cpp b/src/main.cpp index b0133c3..0c7b271 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,7 +106,7 @@ int main(int argc, char ** argv) cout << endl; cout << " --pid=FILE custom pid file location" << endl; cout << " --socket=FILE custom socket file location" << endl; - cout << " --code=CODE custom lock code" << endl; + cout << " --code=CODE custom passcode" << endl; cout << endl; return 0; }