Timeline for /etc/rc.local runs, only writes log file at boot time. Runs as it should after login
Current License: CC BY-SA 4.0
18 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 4 at 4:28 | answer | added | OldBikerPete | timeline score: 0 | |
Jul 4 at 3:57 | comment | added | OldBikerPete | I did that. stopped rc-local.service, moved it to a TEMP folder restarted all the daemons, rebooted the system. New log file was created showing outputs that indicate all my daemons have been started, iptables configuration loaded. Checks with ps ax corroborated my daemons running. Checking now on iptables but it all looks good. Thank you @muru. Now to figure out how to add &^% code formatting on this web site., | |
Jul 4 at 3:35 | review | Close votes | |||
Jul 4 at 12:52 | |||||
Jul 4 at 3:17 | comment | added | OldBikerPete | @muru You'd think. Doesn't happen. So, if I remove my rc-local.service from /etc/systemd/system, /etc/rc.local wil be run by the generator next time I boot up>? | |
Jul 4 at 3:07 | comment | added | muru |
That's the point of the generator, you don't need to do anything except create an /etc/rc.local file and make it executable.
|
|
Jul 4 at 3:06 | comment | added | OldBikerPete | @muru there was no rc-local.service in /etc/systemd/system until I wrote it. If systemd--rc-local-generator exists on my system, where will I find and activate it? | |
Jul 4 at 3:00 | comment | added | muru | 1. Edit your question: askubuntu.com/posts/1519502/edit to see how I added code formatting. 2. See: askubuntu.com/editing-help#code | |
Jul 4 at 2:57 | comment | added | OldBikerPete | @muru How do I add code blocksd? Quote marks don't work for me. | |
Jul 4 at 2:56 | comment | added | OldBikerPete |
@muru Here's an exerpt from the rc.local scripts. #!/bin/bash # # rc.local # LOGFILE=/var/log/rc-local.log # echo "Running /etc/rc.local" >$LOGFILE # # Initialise iptables configuration SCRIPTNAME=/etc/network/iptablesSet.sh if [ -x $SCRIPTNAME ] ; then echo "Running $SCRIPTNAME" >>$LOGFILE $SCRIPTNAME &>>$LOGFILE fi # echo # end
|
|
Jul 4 at 2:49 | comment | added | muru |
There is no Ubuntu 20.03. If you're talking about 20.04, systemd-rc-local-generator is indeed present and installed by default. Please edit your question and use code blocks to add code.
|
|
Jul 4 at 2:38 | comment | added | OldBikerPete | @muru Without using a system service or calling rc.local from some other script which runs at boot time (I'd much rather do this latter), there is no mechanism for running rc.local in this version of Ubuntu ie Server 20.03. | |
Jul 4 at 2:20 | comment | added | muru |
We don't want to see a 3000-line script either. Reduce your rc.local to a minimal part which reproduces the behaviour (writes to log file every time, but doesn't run some other specific action at boot)
|
|
Jul 4 at 2:19 | comment | added | muru |
@OldBikerPete I didn't mean the Unit section when I talked abut "unit". I meant the entire file (a "unit configuration file", or, "unit file", or just "unit", in systemd parlance).
|
|
Jul 4 at 2:10 | comment | added | OldBikerPete | @muru if I delete the [Unit] section of the service file, how do I specify the point in the boot process that the service is supposed to run rc.local? It needs to be pretty much the last thing done as it depends on networks etc. being fully established. | |
Jul 4 at 2:07 | comment | added | OldBikerPete | This web page is not letting me post the 3000-odd line script. | |
Jul 4 at 1:35 | comment | added | muru |
If /etc/rc.local exists and is executable, systemd automatically creates and enables a unit for running it. Would the script running twice in parallel because of your extra unit cause problems?
|
|
Jul 4 at 1:33 | history | edited | muru | CC BY-SA 4.0 |
deleted 20 characters in body
|
Jul 4 at 0:17 | history | asked | OldBikerPete | CC BY-SA 4.0 |