You are not logged in.
Pages: 1
I have two files:
#cat ~/.config/systemd/user/myAlarm_test.service
[Unit]
Description=execute rickroll
[Service]
ExecStart=/usr/bin/vlc /home/bla/.config/systemd/user/rickroll.mp4
[Install]
WantedBy=multi-user.target#cat ~/.config/systemd/user/myAlarm_test.timer
[Unit]
Description=timer test
[Timer]
OnCalendar=+5s
AccuracySec=1us
[Install]
WantedBy=timers.targetrickroll.mp4 exists.
I want to execute rickroll.mp4 with vlc media player 5 seconds after using
systemctl --user myAlarm_test.timerbut this doesn't work. i don't know where to look my mistake and how.
Offline
Did you start the timer? What's the log?
Also, I guess it needs the DISPLAY variable to open vlc.
Online
in the log there is:
/home/bla/.config/systemd/user/myAlarm_test.timer:5: Failed to parse calendar specification, ignoring: +5s
myAlarm_test.timer: Timer unit lacks value setting. Refusing.also systemd-analyze verify returns:
/home/bla/.config/systemd/user/myAlarm_test.timer:5: Failed to parse calendar specification, ignoring: +5s
myAlarm_test.timer: Timer unit lacks value setting. Refusing.
Unit myAlarm_test.timer has a bad unit file setting.how do i set the DISPLAY variable?
Offline
What does +5s have to do with the calender? It makes no sense. Sounds like you're wanting OnActiveSec.
What is systemctl --user myAlarm_test.timer supposed to do? You didn't tell it to start, enable, get status, etc.
Offline
i did OnCalenar=+5s cause i first had a specified time but then wanted to try if it works and did +5s like it was descriped on docs of systemd.time(7).
"systemctl --user myAlarm_test.timer" was a spelling mistake. meant "systemctl --user enable myAlarm_test.timer".
Offline
I also tried setting
OnCalendar=Thu, my:timefor trying it, but it won't execute vlc.
Offline
Then give a log for the correct OnCalendar.
Online
enable tells it to start the next time the user session starts, it doesn't start it now.
Offline
#cat ~/.config/systemd/user/myAlarm_test.timer [Unit] Description=timer test [Timer] OnCalendar=+5s AccuracySec=1us [Install] WantedBy=timers.targetrickroll.mp4 exists. I want to execute rickroll.mp4 with vlc media player 5 seconds after using
systemctl --user enable myAlarm_test.timerbut this doesn't work. i don't know where to look my mistake and how.
As Scimmia says, you also need to start the timer.
But shouldn't the timer include some sort of action? I mean, how is it supposed to start myAlarm_test.service? Maybe something in the [Timer] section, like
Unit=myAlarm_test.serviceI don't know if that's right (I might be missing something), and you might need to change the syntax for a user service.
Edit -- see next post.
Cheers,
Last edited by dakota (2025-05-09 12:50:53)
"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb
Offline
No, that's just wrong. A timer will start the service with the same name. So the naming is correct here.
myAlarm_test.timer starts the service myAlarm_test.service
What exactly is your goal? It works for me:
# /home/user/.config/systemd/user/myAlarm_test.timer
[Unit]
Description=timer test
[Timer]
OnCalendar=Fri, 13:44
AccuracySec=1us
[Install]
WantedBy=timers.target# /home/user/.config/systemd/user/myAlarm_test.service
[Unit]
Description=execute rickroll
[Service]
ExecStart=/usr/bin/vlc /home/user/file.mp4
[Install]
WantedBy=multi-user.targetDepending how you create the files, you have to run
systemctl --user daemon-reloadIf you have a syntax error, it will tell you in
journalctl --user -fThen, you can start/enable the timer:
systemctl --user enable --now myAlarm_test.timer(the --now starts it right away).
But when do you want to run it? In your first post, you gave OnCalendar=+5s which is not a valid date/time.
Online
Yeah, how often do you want it to run?
I use one with these options:
[Timer]
OnBootSec=10min
OnUnitActiveSec=1h
It runs first time after 10 minutes, and then otherwise runs once an hour. With how you're attempting to use "+5s" it looks like you don't want to use the calendar option but instead have it run after some time has elapsed?
If that's the case check out this article: https://wiki.archlinux.org/title/Systemd/Timers
There are some examples in there of different ways to set the timer.
As others have said it timers execute the .service based on the file name: test1.timer will execute test1.service.
You don't enable the service, you just enable the timer and leave the service 'disabled'.
You can manually run the service though if you want to test it using the start command.
Ryzen 7 9850X3D | AMD 7800XT | KDE Plasma
Offline
got my answere. thanks for the help
Offline
Pages: 1