I recently moved to Arch (EndeavourOS) from Mint. Arch doesn't have cron installed as it uses systemd timers instead, and while I could have just installed cron that felt like a lazy answer.
Systemd timers are easy enough to use and I got it working straight away, but I bumped into a comment in the Arch wiki about using a template for the timer so it can be re-used. I'm a bit slow, so I spent a hours trying to work this out, but I couldn't find a good example. Anyway, I now have it working so I thought it would be useful for someone in the future for easy reference .
This is how you create a timer template that can be reused to run a oneshot service under a specific user. In this example it will run on the hour every hour.
Create the timer file.
sudo nano /etc/systemd/system/[email protected]
Paste the following into that file, save and close.
[Unit]
Description=Run %i every hour
[Timer]
OnCalendar=*-*-* *:00:00
Persistent=true
Unit=%i.service
[Install]
WantedBy=timers.target
Create the service file for the script or command you want to run. (using "myscript" in this example)
sudo nano /etc/systemd/system/myscript.service
Paste the following into that file, save and close.
[Unit]
Description=My Script
[Service]
User=username
group=username
Type=oneshot
ExecStart=/usr/local/bin/command -parameters
Now enable and start the timer
sudo systemctl enable [email protected]
sudo systemctl start [email protected]
Yip. I was trying to find a useful front end to manage the audio settings on my focusrite audio interface. Pipewire has the functions and capability to set the sample rate and buffet size on the fly but I failed to find a gui until for it that wasn't part of some other complicated thing. When I suggested the Devs of pipewire should provide a GUI I was politely shot down. The reasons given were; it takes too long, and Linux users don't mind the CMD line. I think this is a mind-set that needs to evolve.