You are not logged in.
OK, after a previous failure with systemd I've decided to revisit it, and things have improved to the extent that (despite some bedding in troubles) I'm starting to quite like the systemd way of doing things. Unlike my last attempts, there's now a noticable improvement in boot speed and I'm starting to get used to the idea of units. Something has been irritating me for a few days though. I run a server that I started via rc.local before. Even with the rc-local.service running with systemd the server didn't start, and I have no idea why.
Having said that, I've taken some time to migrate rc.local to systemd units, most of which was simply a matter of dropping systemd units into place and removing them from rc.local. For the server, I've created a custom unit that seems to be working fine now.
Is a custom unit in such a circumstance the preferential way to go with systemd, and are we, in fact, looking at the end of rc.local for managing startup programs/scripts, or am I simply hacking my way around an unfamiliar system at the moment?
Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703
/ is the root of all problems.
Offline
I think making service files is definitely the way to go. We can still use rc.local with systemd (using initscripts-systemd to get the wrapper service). However, it means that everything you do in rc.local is considered as "one" service. In practice, I guess rc.local is typically a collection of independent things, and as such should be managed independently.
Offline
I think this is related enough to go here.
I have a short script in my rc.local to run powerdown if the laptop's booted on battery, and powerup if booted on AC.
I'd like to switch it to a systemd unit (I've switched to systemd today, so still working my way through the itches).
From what I see, I need to create a script file, setup (eg write and enable) a .service unit to call it. Would this then be a oneshot service?
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Mine works as a one shot service - the unit loads a script which loads my server in a gnu screen session. However, the script is written to monitor various aspects of the server, and loops continuously every 30 seconds, so the script never exits.
I guess since you only need the script to run through once at startup you should be good to go, too.
Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703
/ is the root of all problems.
Offline
Mine works as a one shot service - the unit loads a script which loads my server in a gnu screen session. However, the script is written to monitor various aspects of the server, and loops continuously every 30 seconds, so the script never exits.
I guess since you only need the script to run through once at startup you should be good to go, too.
Okay, that's great thanks. ![]()
Edit: meant to say, I'll give it a try.
Last edited by skanky (2012-07-30 21:56:11)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Roken wrote:Mine works as a one shot service - the unit loads a script which loads my server in a gnu screen session. However, the script is written to monitor various aspects of the server, and loops continuously every 30 seconds, so the script never exits.
I guess since you only need the script to run through once at startup you should be good to go, too.
Okay, that's great thanks.
Edit: meant to say, I'll give it a try.
Worked a treat. I should probably have just tried it, but I'd just spent half an hour or so getting another service file working correctly, thought it worth checking first.
Many thanks Roken.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline