tinystatus icon indicating copy to clipboard operation
tinystatus copied to clipboard

Running on Systemd based Linux

Open B1ue-W01f opened this issue 3 years ago • 4 comments

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.

B1ue-W01f avatar Mar 31 '21 10:03 B1ue-W01f

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

decaby7e avatar Apr 09 '21 23:04 decaby7e

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 avatar May 16 '21 12:05 KsmoinO

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

KsmoinO avatar May 16 '21 12:05 KsmoinO

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.

dusansimic avatar May 21 '21 09:05 dusansimic