Results 1 to 9 of 9

Thread: .timer conflict?

  1. #1

    Default .timer conflict?

    systemctl status gives the following:

    Code:
    systemctl status fstrim.timer● fstrim.timer - Discard unused blocks once a week
       Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
       Active: active (waiting) since Sat 2020-02-15 04:58:46 MST; 1 day 11h ago
      Trigger: Mon 2020-02-17 00:00:00 MST; 7h left
         Docs: man:fstrim
         
    systemctl status mlocate.timer
    ● mlocate.timer - Daily locate database update
       Loaded: loaded (/usr/lib/systemd/system/mlocate.timer; enabled; vendor preset: disabled)
       Active: active (waiting) since Sat 2020-02-15 06:22:11 MST; 1 day 10h ago
      Trigger: Mon 2020-02-17 00:00:00 MST; 7h left
         Docs: man:updatedb
    They're both triggered at the same time. I know they are doing different things, but can they get in each other's way? (I just discovered that updatedb.timer is no more, and was replaced by mlocate.timer, which I enabled just yesterday. I've not got the foggiest why I didn't notice the db wasn't being updated automatically. I do run updatedb quite often, though.)

    TIA
    OpenSuse 15.1, Plasma 5.18
    Gigabyte GA-Z87X-UD4H Mobo; 16G Ram
    Intel Core i5-4570 Processor (6M Cache, up to 3.60 GHz)

  2. #2
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    1,442

    Default Re: .timer conflict?

    Quote Originally Posted by susesteve View Post
    systemctl status gives the following:

    Code:
    systemctl status fstrim.timer● fstrim.timer - Discard unused blocks once a week
       Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
       Active: active (waiting) since Sat 2020-02-15 04:58:46 MST; 1 day 11h ago
      Trigger: Mon 2020-02-17 00:00:00 MST; 7h left
         Docs: man:fstrim
         
    systemctl status mlocate.timer
    ● mlocate.timer - Daily locate database update
       Loaded: loaded (/usr/lib/systemd/system/mlocate.timer; enabled; vendor preset: disabled)
       Active: active (waiting) since Sat 2020-02-15 06:22:11 MST; 1 day 10h ago
      Trigger: Mon 2020-02-17 00:00:00 MST; 7h left
         Docs: man:updatedb
    They're both triggered at the same time. I know they are doing different things, but can they get in each other's way? (I just discovered that updatedb.timer is no more, and was replaced by mlocate.timer, which I enabled just yesterday. I've not got the foggiest why I didn't notice the db wasn't being updated automatically. I do run updatedb quite often, though.)

    TIA
    The timers start the service units. You may check their logs:

    Code:
    erlangen:~ # journalctl -b -u fstrim.service 
    -- Logs begin at Fri 2020-02-14 07:59:41 CET, end at Mon 2020-02-17 07:19:53 CET. --
    Feb 17 05:34:42 erlangen systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
    Feb 17 05:38:03 erlangen fstrim[13748]: /boot/efi: 100,1 MiB (104955904 Bytes) auf /dev/sdb1 getrimmt
    Feb 17 05:38:03 erlangen fstrim[13748]: /home: 155,9 GiB (167347097600 Bytes) auf /dev/nvme0n1p3 getrimmt
    Feb 17 05:38:03 erlangen fstrim[13748]: /: 46,4 GiB (49770946560 Bytes) auf /dev/sdb5 getrimmt
    Feb 17 05:38:03 erlangen systemd[1]: fstrim.service: Succeeded.
    Feb 17 05:38:03 erlangen systemd[1]: Started Discard unused blocks on filesystems from /etc/fstab.
    erlangen:~ # journalctl -b -u mlocate.service 
    -- Logs begin at Fri 2020-02-14 07:59:41 CET, end at Mon 2020-02-17 07:19:53 CET. --
    Feb 17 05:34:42 erlangen systemd[1]: Starting Update locate database...
    Feb 17 05:34:42 erlangen su[13762]: (to nobody) root on none
    Feb 17 05:34:42 erlangen su[13762]: pam_unix(su:session): session opened for user nobody(uid=65534) by (uid=0)
    Feb 17 05:36:21 erlangen systemd[1]: mlocate.service: Succeeded.
    Feb 17 05:36:21 erlangen systemd[1]: Started Update locate database.
    erlangen:~ #
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), openSUSE Tumbleweed, KDE Plasma 5

  3. #3
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,974

    Default Re: .timer conflict?

    Quote Originally Posted by susesteve View Post
    They're both triggered at the same time. I know they are doing different things, but can they get in each other's way?
    Looking at what “mlocate” does, you may have to modify the systemd timer service such that it waits an hour or two before it triggers the “mlocate” service.
    • Take a look at the “systemd.timer” man (5) page – there's a “RandomizedDelaySec=” parameter which modifies the “AccuracySec=” value within the [Timer] section of the systemd file.
    • Please be aware that, after every update/patch of the “mlocate” package, you'll have to check that the systemd timer service file hasn't been reset to the default values …

  4. #4

    Default Re: .timer conflict?

    Ok. I'll do that. Thanks.
    OpenSuse 15.1, Plasma 5.18
    Gigabyte GA-Z87X-UD4H Mobo; 16G Ram
    Intel Core i5-4570 Processor (6M Cache, up to 3.60 GHz)

  5. #5

    Default Re: .timer conflict?

    In /usr/lib/systemd/system/ I modified the mlocate.timer:

    Code:
    [Unit]
    Description=Daily locate database update
    Documentation=man:updatedb
    
    [Timer]
    OnCalendar=daily
    AccuracySec=12h
    Unit=mlocate.service
    Persistent=true
    RandomizedDelaySec=2h
    
    [Install]
    WantedBy=timers.target
    OpenSuse 15.1, Plasma 5.18
    Gigabyte GA-Z87X-UD4H Mobo; 16G Ram
    Intel Core i5-4570 Processor (6M Cache, up to 3.60 GHz)

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    28,528
    Blog Entries
    15

    Default Re: .timer conflict?

    Quote Originally Posted by susesteve View Post
    In /usr/lib/systemd/system/ I modified the mlocate.timer:

    Code:
    [Unit]
    Description=Daily locate database update
    Documentation=man:updatedb
    
    [Timer]
    OnCalendar=daily
    AccuracySec=12h
    Unit=mlocate.service
    Persistent=true
    RandomizedDelaySec=2h
    
    [Install]
    WantedBy=timers.target
    Hi
    That's why we have /etc Roll back your changes and 'copy' the file to /etc/systemd/system, make your modifications here and it will override anything installed by the system.... don't forget to use systemctl daemon-reload as well.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  7. #7
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    1,442

    Default systemctl cat and edit commands

    Quote Originally Posted by malcolmlewis View Post
    Hi
    That's why we have /etc Roll back your changes and 'copy' the file to /etc/systemd/system, make your modifications here and it will override anything installed by the system.... don't forget to use systemctl daemon-reload as well.
    User may want to use systemctl unit commands. mlocate.timer was modified running "systemctl edit mlocate.timer":

    Code:
    erlangen:~ # systemctl cat mlocate.timer 
    # /usr/lib/systemd/system/mlocate.timer
    [Unit]
    Description=Daily locate database update
    Documentation=man:updatedb
    
    [Timer]
    OnCalendar=daily
    AccuracySec=12h
    Unit=mlocate.service
    Persistent=true
    
    [Install]
    WantedBy=timers.target
    
    # /etc/systemd/system/mlocate.timer.d/override.conf
    [Timer]
    RandomizedDelaySec=2h
    
    erlangen:~ #
    Warning!
    Avoiding Overwritten Customization: Always do systemd customization in /etc/systemd/, never in /usr/lib/systemd/. Otherwise your changes will be overwritten by the next update of systemd."

    More at: Customization of systemd
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), openSUSE Tumbleweed, KDE Plasma 5

  8. #8
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,974

    Default Re: systemctl cat and edit commands

    Quote Originally Posted by karlmistelberger View Post
    Warning!
    Avoiding Overwritten Customization: Always do systemd customization in /etc/systemd/, never in /usr/lib/systemd/. Otherwise your changes will be overwritten by the next update of systemd."

    More at: Customization of systemd
    Thanks Karl! – mea culpa – felix culpa …

  9. #9

    Default Re: .timer conflict?

    Ah, OK. Thanks to all.
    OpenSuse 15.1, Plasma 5.18
    Gigabyte GA-Z87X-UD4H Mobo; 16G Ram
    Intel Core i5-4570 Processor (6M Cache, up to 3.60 GHz)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •