Delay service startup on boot?

Kernels & Hardware, configuring network, installing services

Delay service startup on boot?

Postby bjorntj » 2021-02-02 11:36

I have several Java applications that starts at boot but these creates a heavy load on boot, so I was wondering if there is a way (or more ways) to delay the startup for these services, with different delay for each service?


Regards,

BTJ
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
User avatar
bjorntj
 
Posts: 11
Joined: 2021-01-25 12:31

Re: Delay service startup on boot?

Postby Head_on_a_Stick » 2021-02-02 14:38

Are you aware of the existence of internet search engines? This question has been asked before and there are several answers available on the interweb.

I would use
Code: Select all
# systemctl edit name_of_system.unit

Then add
Code: Select all
[Service]
ExecStartPre=/bin/sleep 30

That example adds a 30 second delay to the name_of_systemd.unit file. Mutatis mutandis.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13280
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Delay service startup on boot?

Postby bjorntj » 2021-02-03 07:08

Hmmm.. Didn't think about that way.... Thx.. :)
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
User avatar
bjorntj
 
Posts: 11
Joined: 2021-01-25 12:31

Re: Delay service startup on boot?

Postby Head_on_a_Stick » 2021-02-03 14:21

You should probably check that it works before thanking me. The man page says that ExecStartPre shouldn't be used for long-running commands because they will be fork()ed so it might not work at all. I would check myself but I've just hosed my GNU/Linux partition.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13280
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Delay service startup on boot?

Postby bjorntj » 2021-02-04 14:05

Ok, not that easy then... :)
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
User avatar
bjorntj
 
Posts: 11
Joined: 2021-01-25 12:31


Return to System configuration

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable