Skip to content

Running on Systemd based Linux #10

Description

@B1ue-W01f

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions