sudo systemctl start/restart/status/stop xormon.service
cd ~/xormon-ng; ./xormon.sh stop
su -
cat << EOF > ~/xormon.sudo
# XorMon: lets user xormon control its systemd service.
# start/status/restart/stop: xormon.sh start|restart|stop run from a terminal (start maps to restart)
# --no-block restart: called by xormon.sh from inside the service (web UI restart, upgrade)
# start: optional, only for running "sudo systemctl start xormon.service" directly
xormon ALL=(root) NOPASSWD: /usr/bin/systemctl start xormon.service, \
/usr/bin/systemctl restart xormon.service, \
/usr/bin/systemctl stop xormon.service, \
/usr/bin/systemctl status xormon.service, \
/usr/bin/systemctl --no-block restart xormon.service
EOF
Install the filevisudo -cf ~/xormon.sudo && install -m 0440 -o root -g root ~/xormon.sudo /etc/sudoers.d/xormon
cat << EOF > /etc/systemd/system/xormon.service > [Unit] Description=XorMon NG infrastructure monitoring Documentation=https://xormon.com Wants=network-online.target After=network-online.target postgresql.service StartLimitIntervalSec=600 # Counts every start incl. restarts requested by xormon.sh (terminal, web UI, upgrade), stops crash loops only StartLimitBurst=10 [Service] # xormon.sh start daemonizes the process manager and exits, the manager writes its PID to the lock file. # Every start/restart/stop (terminal, web UI, upgrade) is passed by xormon.sh to systemd, so the main PID # changes only when systemd itself restarts the service. Type=forking PIDFile=/home/xormon/.xormon/manager.lock User=xormon Group=xormon WorkingDirectory=/home/xormon/xormon-ng Environment=LANG=en_US.UTF-8 ExecStart=/home/xormon/xormon-ng/xormon.sh start ExecStop=/home/xormon/xormon-ng/xormon.sh stop # Allow binding to privileged ports (443) for this service only, no file capability on node needed. # No CapabilityBoundingSet: xormon.sh calls sudo systemctl from inside the service (web UI restart, upgrade). AmbientCapabilities=CAP_NET_BIND_SERVICE LimitNOFILE=32768 LimitNPROC=64000 Restart=on-failure RestartSec=10 TimeoutStartSec=300 TimeoutStopSec=60 [Install] WantedBy=multi-user.target > EOFSet file permissions
chomd 644 /etc/systemd/system/xormon.serviceReload services
systemctl daemon-reload
systemctl enable xormon.service
sudo systemctl start xormon.service
Dernière mise à jour :