rc.local not start at the boot

Ed Greshko ed.greshko at greshko.com
Tue Oct 28 23:46:58 UTC 2014


On 10/29/14 07:21, Matthew Miller wrote:
> On Wed, Oct 29, 2014 at 07:18:25AM +0800, Ed Greshko wrote:
>>>> rc.local is working just fine!!
>>> Riddle me this, Ed: why does systemctl report that rc-local.service failed?
>> I don't know, and at this point I don't care.
>> Since /tmp/rc.local.log exists and contains
>> + /home/angelo_dev/bin/syncronize-java_srcs.sh
>> it is obvious that rc.local is being executed.
>> If I were going to assume something I would assume the systemctl failure is related to the failure in the syncronize-java_srcs.sh script.
> Parachuting into the thread here — this seems right. systemd will
> report's rc-local's status as that of the exit code of the script. If
> you want it to alway succeed, end it with
>
> exit 0
>
> (or just ':', although I think `exit 0` is more obvious.)
>
Yes, you are correct.  Even though I don't care about it, I'm a sucker for testing/proving theories.

I created an rc.local file that called a script in my home directory with a deliberate failure.  Both scripts recorded their actions in a file.....  After boot....

rc-local.service - /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
   Active: failed (Result: exit-code) since Wed 2014-10-29 07:34:20 CST; 1min 2s ago
  Process: 1217 ExecStart=/etc/rc.d/rc.local start (code=exited, status=2)

[egreshko at f20f ~]$ cat /tmp/rc.local.log
+ /home/egreshko/bin/run

[egreshko at f20f ~]$ cat /tmp/myscript.log
+ ls /home/egreshko/notreally
ls: cannot access /home/egreshko/notreally: No such file or directory

I'm guessing that in the OP's case where it was reported (code=exited, status=3) that the 3 is the exit code of the rsync command and may indicate.....

3      Errors selecting input/output files, dirs

But since that is just an assumption, I would want to see the results of the rsync which is why I suggested either moving the rsync into rc.local or putting the commands to create a trace file in the syncronize-java_srcs.sh script.


-- 
If you can't laugh at yourself, others will gladly oblige.



More information about the users mailing list