You are not logged in.

#1 2014-09-13 08:07:49

gkjarch
Member
Registered: 2013-03-31
Posts: 22

How to delete or disable a systemd timer?

I don't need mandb to run everyday. Especially in my virtual machine. So I do this:

sudo rm -fr /usr/lib/systemd/system/man-db.*
sudo systemctl daemon-reload
sudo systemctl disable man-db.timer

but I still got this:

systemctl list-timers --all
NEXT                         LEFT     LAST                         PASSED       UNIT                         ACTIVATES
Sun 2014-09-14 00:00:00 HKT  8h left  Sat 2014-09-13 13:57:03 HKT  1h 56min ago logrotate.timer              logrotate.service
Sun 2014-09-14 00:00:00 HKT  8h left  Sat 2014-09-13 13:57:03 HKT  1h 56min ago shadow.timer                 shadow.service
Sun 2014-09-14 15:21:36 HKT  23h left Sat 2014-09-13 15:21:36 HKT  31min ago    systemd-tmpfiles-clean.timer systemd-tmpfiles-cle
n/a                          n/a      Sat 2014-09-13 13:57:03 HKT  1h 56min ago man-db.timer                
n/a                          n/a      n/a                          n/a          systemd-readahead-done.timer systemd-readahead-do

5 timers listed.

which means mand-db.timer is still identified by systemd, although it may not work.
Any ideas?

Offline

#2 2014-09-13 08:14:19

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: How to delete or disable a systemd timer?

Alternatively, you could modify man-db.timer so that it runs when you want it.

Offline

#3 2014-09-13 08:38:31

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: How to delete or disable a systemd timer?

It's a static unit, so you can't use "disable". You can remove the timer unit, but that won't survive a man-db update, so masking it would be better. `systemctl mask` creates a symlink (to /dev/null) called man-db.timer under /etc to override the one under /usr/lib. You could instead create your own copy there with a modified trigger (basically what tomk suggests, but you shouldn't modify unit files under /usr/lib).

Offline

#4 2014-09-13 10:12:56

gkjarch
Member
Registered: 2013-03-31
Posts: 22

Re: How to delete or disable a systemd timer?

Thanks tomk and Raynman. but I don't think "cover it" is the best way. man-db is a index for searching. It should be a event triger, not a time triger. And someone like me rarely use it makes the timer shouldn't exist. Systemd should offer a command to remove it like service. I want to know how systemd store timer information even the file has been removed.

Last edited by gkjarch (2014-09-13 10:13:51)

Offline

#5 2014-09-13 10:45:34

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: How to delete or disable a systemd timer?

If you rarely use it and don't wanna mask the timer, just remove mlocate.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2014-09-13 11:14:53

gkjarch
Member
Registered: 2013-03-31
Posts: 22

Re: How to delete or disable a systemd timer?

graysky wrote:

If you rarely use it and don't wanna mask the timer, just remove mlocate.

mlocate package was not installed!

Offline

#7 2014-09-13 11:24:08

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: How to delete or disable a systemd timer?

I think graysky meant to say remove man-db, not mlocate.

Last edited by tomk (2014-09-13 11:25:46)

Offline

#8 2014-09-13 11:37:28

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: How to delete or disable a systemd timer?

@gkjarch Ad triggering: Mask the man-db.timer and create /etc/systemd/system/man-db.path with this content:

[Unit]
Description=Update man-db cache

[Path]
PathChanged=/var/lib/pacman/local
PathChanged=/usr/share/man/
Unit=mad-db.service

 Untested but it should work, I use the same for triggering regeneration of openbox applications menu, only not as static.

Edit: Probably the second path should be lower, since inotify is not recursive (man inotify).

Last edited by emeres (2014-09-13 11:43:00)

Offline

#9 2014-09-14 06:21:11

gkjarch
Member
Registered: 2013-03-31
Posts: 22

Re: How to delete or disable a systemd timer?

Thanks emeres. I will consider your way. I still think the timer thing is a design defect.

To tomk and graysky, remove man-db package is not an option. Because if you use Linux for several years, you are familiar with the applications you usually use. If something new comes out for example systemd. I will read ArchLinux Wiki first, it may mention man page like "See man systemd.unit for details. ". So command apropos is rarely used, but command man is not.

The reason I want to remove man-db timer is not only because above, but also because it slows down statup. I use double OS Windows and Linux. Access data in Linux partition (include a EXT4 backup hard drive) by using VBox. Command mandb runs 5 minutes at least and CPU is fully loaded in VBox. That really annoy me. Especially everyday.

Last edited by gkjarch (2014-09-14 06:23:52)

Offline

#10 2014-09-18 13:16:41

kaslusimoes
Member
Registered: 2013-12-19
Posts: 51

Re: How to delete or disable a systemd timer?

I've found two possible workarounds on this:

  • Setting the timer to work an specific hour a day as indicated on this Manjaro forum (worked finely);

  • Setting the timer to work some seconds after booting, as explained on systemd.timer manual (haven't tested but should work as well).

Hope it helps

Offline

#11 2014-09-18 21:30:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: How to delete or disable a systemd timer?

kaslusimoes wrote:
  • Setting the timer to work some seconds after booting, as explained on systemd.timer manual (haven't tested but should work as well).

This is the correct approach. OnBootSec=30min, for example...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB