Welcome, Guest. Please login or register.

Author Topic: Running moni.pl as a systemd service  (Read 2981 times)

gerold

  • Newbie
  • *
  • Posts: 14
    • View Profile
Running moni.pl as a systemd service
« on: January 29, 2018, 11:52:40 am »
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: [Select]
$ 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

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

Code: [Select]
===================================================================
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>
 

Hope this helps!

Gerold

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2903
    • View Profile
    • NeDi
Re: Running moni.pl as a systemd service
« Reply #1 on: January 30, 2018, 06:54:06 pm »
Interesting, tx. I've been using startup scripts for Debian, CentOS etc. Is there an advantage of using systemd?
« Last Edit: January 30, 2018, 06:56:14 pm by rickli »
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo