im getting the error: Failed to start git-auto.timer: Unit git-auto.timer not found.
I create 2 files in /etc/systemd/system:
git-auto.service
git-auto.timer
git-auto.timer:
[Unit]
Description="Run git-auto.sh"
[Timer]
OnCalendar=*-*-* 09:00:00
OnCalendar=*-*-* 18:00:00
Persistent=true
[Install]
WantedBy=multi-user.target
git-auto.service:
[Unit]
Description="Rodar git-auto-timer"
[Service]
ExecStart= my correct script location
if i run : systemd-analyze verify /etc/systemd/system/git-auto.*
i dont get nothing, so looks right
I cant find the problem , any tips folks ?
Edit: im on silverblue
What package provides those files.?
Are they home-brewed or something else.?
They do not appear to be from a fedora repo.
They are not. I’m trying to create a timer to run a script that I did
The script name is git-auto.sh
chrisawi
(Chris Williams)
December 18, 2023, 3:49am
4
Please share systemctl cat git-auto.timer
and systemctl status git-auto.timer
barryascott
(Barry A Scott)
December 18, 2023, 4:27am
5
Also what does systemctl list-timers
report?
vekruse
(Villy Kruse)
December 18, 2023, 5:14am
6
Did you create these units as system
or as user
units? The latter would make most sense.
system
users goes int /etc/systemd/system
and user
units goes into /etc/systemd/user
.
For user
units use systemctl --user ...
.
barryascott
(Barry A Scott)
December 18, 2023, 8:53am
7
As you can see in the first post they are system units.
They may be better as user timers.
hmmsjan
(h.janssen)
December 18, 2023, 9:20am
8
Did you use a text editor or “systemctl edit” to create the files?
In case of text editor, have you entered “systemctl daemon-reload” to make systemd aware of the new files?
2 Likes
grumpey
(Joe)
December 18, 2023, 10:01am
9
1 Like
barryascott
(Barry A Scott)
December 18, 2023, 10:07am
10
I have never needed to use that target for system timers to work.
crazymonkey
(Crazy Monkey)
December 18, 2023, 10:57am
11
i change here but the error persist
crazymonkey
(Crazy Monkey)
December 18, 2023, 10:58am
12
yes i used text editor to edit, but late use nano
crazymonkey
(Crazy Monkey)
December 18, 2023, 11:07am
13
like: sudo systemctl --user start git-auto.timer ?
and just for me understand , its a recommendation like best practices , or it can solve the problem ?
crazymonkey
(Crazy Monkey)
December 18, 2023, 11:10am
14
got these 2 :
systemctl cat:
No files found for git-auto.timer.
systemctl status:
Unit git-auto.timer could not be found.
vekruse
(Villy Kruse)
December 18, 2023, 11:52am
15
It is not a recommendation. The --user
is for enabling or otherwise managing user services for a single user. For all users use --global
instead.
As your units are system units, use neither or perhaps --system
(which is assumed by default).
By the way: systemctl status git-auto.timer
and systemctl status git-auto.service
would be the first thing I would try.
Also for those who don’t know. After editing a unit file, run systemctl daemon-reload
. The changes won’t take effect until you do.
barryascott
(Barry A Scott)
December 18, 2023, 12:04pm
16
Here is examnple out from my system with timers I have defined.
Please show exactly the commands you run and what the output is using the preformatted text feature. Its the </>
button when you edit your response.
$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Mon 2023-12-18 11:59:01 GMT 2s Mon 2023-12-18 11:58:31 GMT 27s ago temperature.timer temperature.service
Mon 2023-12-18 11:59:02 GMT 3s Mon 2023-12-18 11:58:31 GMT 27s ago givenergy.timer givenergy.service
Mon 2023-12-18 12:09:47 GMT 10min Mon 2023-12-18 10:54:17 GMT 1h 4min ago dnf-makecache.timer dnf-makecache.service
...
12 timers listed.
Pass --all to see loaded but inactive timers, too.
$ systemctl status temperature.timer
â—Ź temperature.timer
Loaded: loaded (/etc/systemd/system/temperature.timer; enabled; preset: disabled)
Active: active (waiting) since Sun 2023-12-17 08:54:56 GMT; 1 day 3h ago
Trigger: Mon 2023-12-18 11:59:35 GMT; 23s left
Triggers: â—Ź temperature.service
Dec 17 08:54:56 fender.chelsea.private systemd[1]: Started temperature.timer.
$ systemctl cat temperature.timer
# /etc/systemd/system/temperature.timer
[Unit]
Description=temperature.timer
[Timer]
OnBootSec=60 seconds
OnUnitInactiveSec=30 seconds
[Install]
WantedBy=multi-user.target
$ ls -l /etc/systemd/system/temp*
-rw-r--r-- 1 root root 202 Feb 3 2022 /etc/systemd/system/temperature.service
-rw-r--r-- 1 root root 203 Feb 3 2022 /etc/systemd/system/temperature.service~
-rw-r--r-- 1 root root 134 Aug 9 2021 /etc/systemd/system/temperature.timer
hmmsjan
(h.janssen)
December 18, 2023, 12:12pm
17
Literally copied, only “my correct script location” replaced by xmessage which does not work lacking display but leaves a message in the log.
systemctl status git-auto.timer
● git-auto.timer - “Run git-auto.sh”
Loaded: loaded (/etc/systemd/system/git-auto.timer; disabled; preset: disabled)
Active: active (waiting) since Mon 2023-12-18 13:03:46 CET; 10s ago
Trigger: Mon 2023-12-18 18:00:00 CET; 4h 56min left
Triggers: â—Ź git-auto.service
navras
(NAVras)
December 18, 2023, 12:29pm
18
What does stat /etc/systemd/system/git-auto.timer
say? It should be
Context: system_u:object_r:systemd_unit_file_t:s0
Just taking a guess: SELinux is preventing systemd from reading the file. (If the file was created elsewhere and moved into the folder.)
There are some differences functionality wise. E.g. The unit starts on first login instead of at boot, and units by default does not linger if no user session exists. Basically:
--user
Talk to the service manager of the calling user, rather than the service manager of the system.
crazymonkey
(Crazy Monkey)
December 18, 2023, 1:53pm
19
I got this :
Context: unconfined_u:object_r:etc_t:s0
i delete the older files and create equally new ones in /etc/systemd/system/user/
editing from there, and got the same error
i run:
systemctl --user start git-auto.timer
didnt get any error, but the timer also didint get listed in systemctl list-timers
crazymonkey
(Crazy Monkey)
December 18, 2023, 1:55pm
20
yeah bro, i dont know why is not working, im on silverblue dont know if this make any difference
“my correct script location” is the path of my script like /home/…