-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I'm running the agent on Arch Linux with systemd and no cron. For this, I need to manually comment out the checks and setup processes for cron, as the default install script fails when cron is not available.
After installing with the modified script, I manually create the following systemd files:
/etc/systemd/system/hetrixtools-agent.service
[Unit]
Description=Service for running HetrixTools Server Monitoring Agent
[Service]
Type=oneshot
ExecStart=/etc/hetrixtools/hetrixtools_agent.sh >> /etc/hetrixtools/hetrixtools_cron.log 2>&1
[Install]
WantedBy=multi-user.target
/etc/systemd/system/hetrixtools-agent.timer
[Unit]
Description=HetrixTools Server Monitoring Agent Timer
[Timer]
OnBootSec=20
OnUnitActiveSec=1min
AccuracySec=1s
[Install]
WantedBy=timers.target
Then I enable and run the agent with:
# systemctl enable hetrixtools-agent.timer
# systemctl start hetrixtools-agent.timer
It would be nice to include this behaviour in the official install script in order to support a wider range of servers.
Perhaps the install script could detect which init environment is used with ps --no-headers -o comm 1 (which returns either 'systemd' or 'init') and continue with the correct installation procedure. Or perhaps if crontab is not found, the script could check for systemd and use that when available.