NeDi Software Specific > Installation

Running moni.pl as a systemd service

(1/1)

gerold:
Hi everybody,

since I no longer enjoyed  (re)starting moni.pl manually, I wrote the following service definition in order to let systemd care for the monitoring process.


--- Code: ---$ cat /etc/systemd/system/nedimoni.service
[Unit]
Description=NeDi monitoring daemon for network infrastructure
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=nediusr
ExecStart=/opt/nedi/current/moni.pl
PrivateTmp=yes
Restart=always
RestartSec=180
#StandardError=syslog
IPAccounting=yes

[Install]
WantedBy=multi-user.target

--- End code ---

To see that services status in NeDi, I patched System-Services.php as follows.


--- Code: ---===================================================================
RCS file: ./RCS/System-Services.php,v
retrieving revision 1.1
diff -u -r1.1 ./System-Services.php
--- ./System-Services.php       2018/01/22 11:17:41     1.1
+++ ./System-Services.php       2018/01/22 11:29:04
@@ -134,6 +134,12 @@
 </tr>
 </table>
 <p>
+<h2>systemd moni status</h2>
+<div class="textpad code pre txta tqrt">
+$ systemctl status -l nedimoni.service
+<?= shell_exec('systemctl status -l nedimoni.service') ?>
+
+</div><br>
 
 <h2><?= $cmdlbl ?></h2>
 

--- End code ---

Hope this helps!

Gerold

rickli:
Interesting, tx. I've been using startup scripts for Debian, CentOS etc. Is there an advantage of using systemd?

Navigation

[0] Message Index

Go to full version