You are not logged in.

#1 2014-07-21 09:19:21

RobinJ
Member
From: Belgium, Europe
Registered: 2012-01-05
Posts: 21
Website

Run tasks asynchronously at boot

[robin@pingwing ~]$ systemd-analyze blame | head -n 5
          3.595s updatedb.service
          1.403s man-db.service
           196ms systemd-fsck@dev-sdb6.service
           185ms systemd-logind.service
           166ms alsa-restore.service

updatedb and man-db are run every time the system boots (or only the first boot of the day, not sure) to update their databases, which is fine. I like it that way.
As you can clearly see they're not holding up the boot process for too long, although still 90% of the boot time is spent on those 2 services smile

I was wondering whether there's a way to have them run asyncronously? So they'd still be run every time, but the boot process would continue rather than waiting for those 2 processes to exit.

Thank you.

Offline

#2 2014-07-21 09:38:14

phw
Member
Registered: 2013-05-27
Posts: 318

Re: Run tasks asynchronously at boot

Why run those tasks on system startup at all? On my system the man-db service is inactive, but is set to run daily via systemd timers (https://wiki.archlinux.org/index.php/Sy … ctionality)

I would check your output of

systemctl list-timers 

Probably those two services are already there.

Offline

#3 2014-07-21 09:53:08

RobinJ
Member
From: Belgium, Europe
Registered: 2012-01-05
Posts: 21
Website

Re: Run tasks asynchronously at boot

phw wrote:

Why run those tasks on system startup at all? On my system the man-db service is inactive, but is set to run daily via systemd timers (https://wiki.archlinux.org/index.php/Sy … ctionality)

I would check your output of

systemctl list-timers 

Probably those two services are already there.

[robin@pingwing ~]$ systemctl list-timers 
NEXT                          LEFT     LAST                          PASSED    UNIT                         ACTIVATES
Tue 2014-07-22 00:00:00 CEST  12h left Mon 2014-07-21 11:05:04 CEST  46min ago logrotate.timer              logrotate.service
Tue 2014-07-22 00:00:00 CEST  12h left Mon 2014-07-21 11:05:04 CEST  46min ago man-db.timer                 man-db.service
Tue 2014-07-22 00:00:00 CEST  12h left Mon 2014-07-21 11:05:04 CEST  46min ago shadow.timer                 shadow.service
Tue 2014-07-22 00:00:00 CEST  12h left Mon 2014-07-21 11:05:04 CEST  46min ago updatedb.timer               updatedb.service
Tue 2014-07-22 11:20:08 CEST  23h left Mon 2014-07-21 11:20:08 CEST  31min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service

So what do I do with this?

Either way, I have no problem with it running at boot. I was just wondering whether I could do it asynchronously.

Offline

#4 2014-07-21 11:28:47

phw
Member
Registered: 2013-05-27
Posts: 318

Re: Run tasks asynchronously at boot

RobinJ wrote:

So what do I do with this?

I just checked this myself, for both updatedb and man-db a systemd timer unit gets installed by default, which schedule the tasks to be run daily. That means there is no real need to run the tasks at startup and you could just disable both services with systemctl.

RobinJ wrote:

Either way, I have no problem with it running at boot. I was just wondering whether I could do it asynchronously.

I don't think they really are executed sequentially as you assume. Both .service files don't add any special dependencies on other services and should be able to run in parallel.  systemd-analyze blame just prints the running units and the time they took to initialize. Try

systemd-analyze critical-chain

to really see what services affect your overall boot time.

Last edited by phw (2014-07-21 11:29:31)

Offline

#5 2015-09-24 17:48:15

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 671
Website

Re: Run tasks asynchronously at boot

This post and the wiki page linked clear out the point about man-db and updatedb systemd services and timers. Wanted to understand as they can show up with 15+ sec each on a tiny machine.
Just want to say thank, guys.


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

#6 2015-09-25 09:29:37

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,865
Website

Re: Run tasks asynchronously at boot

kozaki, you have been here long enough to know our rules about necrobumping, please don't do it.

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB