0

I am using rc.local to run a python script on boot up on a raspberry pi and it almost always runs without an issue but on occasion, it seems like it might be crashing. Can a script run in rc.local crash with no error in the code? Would it be better to use systemd instead?

  • Do you think the dinner I had yesterday was rotten? What you recommend me to eat today? ;-P Without you entering into specifics, we cannot really help you. – Rui F Ribeiro Feb 28 '18 at 17:50
  • @RuiFRibeiro The script is a client program that connects to a server and sends images but it is disconnecting on occasion and I'm fairly certain the code doesn't have any errors and should be able to handle any errors. So I am wondering if rc.local is known to stop programs I don't know how to get anymore information than that. – JackHipson300 Feb 28 '18 at 17:55
  • No, rc.local does not stop programs willy nilly. Enable debugging in your program, look at logs, run it outside of rc.local and investigate what's happening. – Kusalananda Feb 28 '18 at 18:04
  • 1
    Why would you make an image transfer part of your boot process?? – Gerard H. Pille Feb 28 '18 at 18:18
  • @GerardH.Pille He's probably starting it as a daemon thingy. What I'm most interested in is why he thinks his program is error free. – Kusalananda Feb 28 '18 at 18:33
0

rc.local doesn't do much besides run your code.

A benefit to systemd is that it has an option to restart your code if it crashes, which rc.local does not.

So if you can't prevent your code from crashing in the same way again, perhaps you can design so that it at least has a chance of working properly if it is restarted after such a crash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.