You are not logged in.
I am trying to create a .service and .timer that periodically run a script every 10 minutes.
The script is a simple script to run hyprsunset at 6 pm. The service and timer correctly run on boot and hyprsunset correctly runs (given the correct time) on boot, but after that the timer does not activate again despite saying it is active. hyprsunset.service and hyprsunset.timer are in ~/.config/systemd/user/
Any help would be greatly appreciated.
hyprsunset.service:
[Unit]
Description=Run hyprsunset script
After=graphical-session.target
[Service]
Type=oneshot
ExecStart=/home/cieranholmes/Scripts/hyprsunset.shhyprsunset.timer
[Unit]
Description=Run hyprsunset every 10 minutes
[Timer]
OnBootSec=5
OnCalendar=*:00/10
Unit=hyprsunset.service
[Install]
WantedBy=timers.targethyprsunset.sh
#!/bin/sh
sleep 5
# Kill current hyprsunset session
killall -q hyprsunset
# Get the current hour (in 24-hour format)
current_hour=$(date +%H)
echo "Current hour is $current_hour"
# If it’s 6pm to 7am, hyprsunset -t 5000
# Else hyprsunset -t 6500
if [ "$current_hour" -ge 18 ] || [ "$current_hour" -le 6 ]; then
echo "Changing to nighttime hyprsunset"
hyprsunset -t 3400
else
echo "Changing to default hyprsunset"
hyprsunset -t 6500
fiOutput of "systemctl --user list-timers":
NEXT LEFT LAST PASSED UNIT ACTIVATES
- - Fri 2025-05-30 17:05:28 SAST 16min ago hyprsunset.timer hyprsunset.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.Last edited by Ceetron (2025-05-30 15:40:34)
Offline
The service and timer correctly run on boot and hyprsunset correctly runs (given the correct time) on boot, but after that the timer does not activate again
OnCalendar=*:00/10
I don't understand that syntax. What if you tried something like
OnUnitActiveSec=10mwould it fire off every 10 min?
And how did you determine that the timer does not fire again? By the results of the script? Or by looking in the journal?
Cheers,
"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb
Offline