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

Running on Systemd based Linux #10

Open
B1ue-W01f opened this issue Mar 31, 2021 · 4 comments
Open

Running on Systemd based Linux #10

B1ue-W01f opened this issue Mar 31, 2021 · 4 comments

Comments

@B1ue-W01f
Copy link

Hi all,

Just really adding this here as a helper for anyone looking to implement on Linux using systems.

Not saying this is at all the correct way. I'm running this all through Saltstack so apologies if this isn't directly applicable.

Ive used a "runner" file to control the actions outside the processing script:

Changes to directory where the project is cloned, runs the script and generates a temporary file, moves it over the previous file were the webserver is looking.

#!/bin/bash 
cd /home/vagrant/tinystatus 
./tinystatus > /home/vagrant/tinystatus/index.html.tmp
mv /home/vagrant/tinystatus/index.html.tmp /var/www/tinystatus/index.html

Then I have a systemd service:

[Unit]
Description=Tinystatus reports availability of services
Wants=tinystatus.timer

[Service]
Type=simple
User=vagrant
Group=vagrant
ExecStart=/home/vagrant/tinystatus.runner.sh

[Install]
WantedBy=multi-user.target

And a systemd timer:

[Unit]
Description=Timer that periodically triggers tinystatus.service
Requires=tinystatus.service

[Timer]
OnCalendar=minutely

[Install]
WantedBy=timers.target

The service and timer are then enabled and timer started.

@decaby7e
Copy link

decaby7e commented Apr 9, 2021

Very much appreciate these resources. Would be nice to include in the README perhaps?

@KsmoinO
Copy link

KsmoinO commented May 16, 2021

Instead of using cd command, you may use WorkingDirectory on [Service] section of your service file.

Moreover you do not need [Install] section in your service file neither Require=tinystatus.service in your timer file

@KsmoinO
Copy link

KsmoinO commented May 16, 2021

You can also run tinystatus with args in your runner
./tinystatus /path/to/checks.csv /other/path/to/incidents.txt > /path/to/www/index.html

@dusansimic
Copy link

I've just made a repo with this set up. I might make packages for various distributions or a simple install script but the instructions for installing the service are placed in readme.

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

No branches or pull requests

4 participants