Hi, I’m making an application in Python and my script runs some terminal commands via “os.system”. However, after them commands are run, the Pi needs to reboot to make the changes happen. I need to carry on running the rest of the script once the Pi reboots, how would I do that? Basically how do I continue running the script once the pi has rebooted again?
Thanks,
Nathan
-
- Posts: 8
- Joined: Wed Jun 12, 2019 8:49 pm
Re: Reboot raspberry pi and run a script after
Can't be done. You can start the script automatically at reboot, but you can't have it resume. The current state can't be maintained across boots.Nathan1258 wrote: ↑Fri Jun 14, 2019 3:33 pmBasically how do I continue running the script once the pi has rebooted again?
Re: Reboot raspberry pi and run a script after
Nathan1258 wrote: ↑Fri Jun 14, 2019 3:33 pmHi, I’m making an application in Python and my script runs some terminal commands via “os.system”. However, after them commands are run, the Pi needs to reboot to make the changes happen. I need to carry on running the rest of the script once the Pi reboots, how would I do that? Basically how do I continue running the script once the pi has rebooted again?
Thanks,
Nathan
Maybe break the script into two : pre-boot and post-boot. Arrange for the post-boot element to be run automatically after a reboot.
Or re-examine your assumption that the entire system needs to be rebooted to enable the configuration changes you are making: maybe just the process or sub-system involved needs restarting?
Re: Reboot raspberry pi and run a script after
Get the first part to check for a file on the SD card.
If it’s not present, run the first part, create the file and do a clean reboot
If it’s present, run the second part and delete the file
If it’s not present, run the first part, create the file and do a clean reboot
If it’s present, run the second part and delete the file
-
- Posts: 8
- Joined: Wed Jun 12, 2019 8:49 pm
Re: Reboot raspberry pi and run a script after
Yep. I went for that idea. I just have a normal file with either ‘true’ or ‘false’ in and do whatever depending on that.
Re: Reboot raspberry pi and run a script after
When using Windows I had a lot of code handling the old style ini files. Imagine my pleasure to find the config parser module for Python https://docs.python.org/3.7/library/configparser.html
First tine I read up on this was for a background program that had been hard coded for a given job and every time I wanted a new action I coded it in
it’s now driven by the file contents and a lot easier to add bits in 
First tine I read up on this was for a background program that had been hard coded for a given job and every time I wanted a new action I coded it in

