H
H
hypzin2017-04-27 05:05:35
linux
hypzin, 2017-04-27 05:05:35

How to make rc.local work?

It is necessary to restart the supervisor at system startup, I decided to do it through rc.local
in /etc/rc.local and wrote
#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/etc/super
exit 0
In theory, if you execute sudo /etc/rc.local then it is executed, it turns out that rc.local itself does not start at system startup?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily Hovut, 2017-04-27
@extraterrestrial

1. What does it mean to reboot at system boot? M.b. upload?
2. An easy way to check if rc.local is running after booting 3. For a complete answer, you need to know your Linux distribution, for example, in Ubuntu, rc.local is launched via the /etc/init.d script, you just need to add it to which runlevel you need

Y
Yuri Chudnovsky, 2017-04-27
@Frankenstine

Starting from /etc/rc.local will be at an unpredictable point in time, for example before the service you want to restart is even started. Therefore, it would be more correct to create your own systemd service, which will have the appropriate dependencies.

V
Vladimir, 2022-03-03
@BOBAH1

Debian 11 Bullseye :
create a new rc.local file manually in /etc/ with the lines:

#!/bin/sh -e
#
# rc.local
#
#Oo - tyt nuwu 4to xo4ewb

exit 0

Make it executable:
chmod +x /etc/rc.local
Reload the daemon:
systemctl daemon-reload
Start:
systemctl start rc-local
Check the status:
systemctl status rc-local
This code should appear:
● rc-local.service - /etc/rc.local Compatibility
     Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/rc-local.service.d
             └─debian.conf
     Active: active (exited)
       Docs: man:systemd-rc-local-generator(8)
    Process: 58756 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

all. ( translation 11: https://blog.wijman.net/enable-rc-local-in-debian-...
For Ten in Russian: https://dondub.com/2021/04/vklyuchenie-rc-local -v-...
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question