Questions tagged [rc.local]
26 questions
52
votes
3 answers
What is the correct substitute for rc.local in systemd instead of re-creating rc.local
I cannot find the correct way to execute some local scripts (or very local commands) at systemd, I already know I must not create a service (in systemd a unit) for this kinds of scripts (or I must?)....
The workaround that I found is to create…
Luciano Andress Martini
- 6,490
- 4
- 26
- 56
3
votes
2 answers
Python script executed in rc.local does not log, unless with a non-zero code
My rc.local service executes a python script on startup: it works fine but it doesn't log anywhere, unless an error occurres and exits with a non-zero code. This script runs scheduled operations, therefore it will run pending in background, unless…
Daniele Zagnoni
- 31
- 3
2
votes
1 answer
Block internet for a specific user, permanently
This works:
sudo iptables -A OUTPUT -m owner --uid-owner {USERNAME} -j REJECT
to block internet for a specific user. But it's not permanent.
What's the easiest way to make this persistent after a reboot, with newer systems (with systemd)?
Creating…
Basj
- 2,351
- 9
- 37
- 70
2
votes
2 answers
Run a command as root on startup
I need to run this command line at startup:
echo 1 > /sys/module/bluetooth/parameters/disable_ertm
When I go to terminal type SU enter my password type that command it works perfectly, yet when I add that line to /etc/rc.local before the exit 0…
Steve
- 23
- 3
1
vote
3 answers
LXC container will start at the command line, but not automatically, from cron's @reboot or from /etc/rc.init
I can always start my container successfully with:
fadedbee@host:~$ sudo lxc-start -n mycontainer
It used to start automatically, until I bound some directories on a local ZFS to it.
I added the following to /etc/rc.local:
/bin/date >>…
fadedbee
- 797
- 1
- 5
- 23
1
vote
1 answer
rc.local - script message suppression
I am working on a Raspberry Pi project; it includes NUT server configuration and making the OS Image read-only.
I have completed the required steps and configured the NUT server.
I uninstalled the cron and required a alternate method to launch my…
Kunal Sonone
- 65
- 1
- 9
1
vote
1 answer
Can't pipe stdout of a python script that runs in background to file
I have a python script myscript.py on a RaspberryPi with Raspbian that starts on boot via rc.local file. Since it has infinite loop in it I need to run it in background. So far so good but I also want to log this script's stdout to file with a pipe…
muliku
- 185
- 4
- 10
1
vote
2 answers
If rc.local is run as root why can't it touch a file
I wish to execute a script every time on boot-up using /etc/rc.local.
My script for example is called startscript.sh which is stored in /home/debian as below. It first tries to create a file called test.log and then does other things.
However, I…
Engineer999
- 1,111
- 2
- 15
- 32
0
votes
0 answers
command not found, while it exist in appropriate place
i had fresh installed debian 12 and almost all commands are not found.
root@debian:/# dpkg-reconfigure keyboard-configuration
bash: dpkg-reconfigure: command not found
i find it here
root@debian:/home/lm# find /usr -type f -name…
ant
- 11
- 3
0
votes
0 answers
Rc local keep stopping and restarting
I want jboss to start on boot. I created a simple script on rc.local
nohup /data/jboss-eap-7.2/bin/startup-server.sh 0.0.0.0 &
It started after booting, but when I check the log, there's some point where jboss stopped and the program restarted and…
alya
- 1
0
votes
1 answer
/etc/rc.local not being run everytime a user logs in via ssh
I have set up the /etc/systemd/system/rc-local.service as follows:
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
…
E. Jaep
- 137
- 5
0
votes
2 answers
Program starts from rc.local but doesn't do anything
I have a program which uses msqllib. It scans some hardware that I build and then updates a mysql database. This program has been running for a number of years but I have never been able to autostart it when the system reboots.
Now I have an issue…
Nigel W Johnson
- 3
- 1
0
votes
1 answer
Why does sudo command executed in rc.local file create two processes? One with the sudo command and one without
To run the process at boot time, I wrote a script in the rc.local file using the sudo command.
However, if you look up processes with the ps command, there are two processes, one with the sudo command and one without.
It doesn't affect the actual…
0
votes
1 answer
Run script in rc.local not as root
I want to launch python script on boot, but rc.local launches it as root, which causes error in my python module. Is it possible to make it run as non root? Instead of nohup python /home/pi/script.py & maybe I could use something which says it to…
Ri Di
- 103
- 4
0
votes
0 answers
python wont import can module in rc.local
I want to automate my python script which controls devices through CAN. I can start script simply from terminal, but I dont want to do that every time. So I put nohup python /home/pi/script.py & in rc.local - did not work. I tried putting print('1')…
Ri Di
- 103
- 4