Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for systemd timers alongside cron #32

Open
jnaskali opened this issue Sep 23, 2020 · 1 comment
Open

Support for systemd timers alongside cron #32

jnaskali opened this issue Sep 23, 2020 · 1 comment

Comments

@jnaskali
Copy link

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.

@hetrixtools
Copy link
Owner

Thank you for the feedback, we'll test it out and try to implement such a scenario in future versions of our agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants