You are not logged in.

#1 2018-03-04 15:51:28

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

Unit timer

I am trying to use TIMER following the description here:
https://seanmcgary.com/posts/how-to-use-systemd-timers/

When I try to start service I get this:
Failed to start etc-systemd-system-minute\x2dtimer.timer.mount: Unit etc-systemd-system-minute\x2dtimer.timer.mount not found

I was not able to find any hint how to solve it.

Can somebody advise?

Offline

#2 2018-03-04 16:10:27

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,678

Re: Unit timer

This is unnecessarily convoluted you can just have a .timer WantedBy=timers.target and a corresponding service file of the same name, that way an enabled timer will automatically find it's service.

That said unless you post your files and the names and locations of what you are trying to do, no one can help you.

Offline

#3 2018-03-04 16:26:08

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

Re: Unit timer

this is exactly 100% the same as on the page for which I provided a link.
See section "Creating the timer"

/etc/systemd/system/minute-timer.timer
[Unit]
Description=Minute Timer

[Timer]
OnBootSec=5min
OnCalendar=*:0/1
Unit=minute-timer.target

[Install]
WantedBy=basic.target

(..)

/etc/systemd/system/minute-timer.target

[Unit]
Description=Minute Timer Target
StopWhenUnneeded=yes

(..)

/etc/systemd/system/testservice.service

[Unit]
Description=Prints the date every minute
Wants=minute-timer.timer

[Service]
ExecStart=/bin/date

[Install]
WantedBy=minute-timer.target

Offline

#4 2018-03-06 09:01:02

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,678

Re: Unit timer

I'm not sure why it tries to resolve a mount unit, but that might've simply been a change in systemd to not allow custom timer targets or similar (and the basic.target wantedby is weird for a timer anyway). Does it start to work if you change the timer's WantedBy=timers.target and remove the wants and the wantedby (in fact the entire install section) from the testservice, and then enable the timer?

You'd be much better advised to read https://wiki.archlinux.org/index.php/Systemd/Timers instead of blog posts.

Last edited by V1del (2018-03-06 09:03:26)

Offline

#5 2018-03-06 18:39:54

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

Re: Unit timer

thanks. I just skipped the whole Timer thing and went to good - well known CRON.
I have installed cronie and it works wonderful.

Offline

Board footer

Powered by FluxBB