tinystatus
tinystatus copied to clipboard
Running on Systemd based Linux
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.
Very much appreciate these resources. Would be nice to include in the README perhaps?
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
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
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.