What is the safest command to reboot the device cleanly? I will be running it on a R.Pi 3B or 3+ or whatever (the second best one?)
Restarting LibreElec via Cron, is "shutdown -r now" safe for the SDcard and database?
-
FeFiFoFum -
April 6, 2019 at 8:09 AM -
Thread is Unresolved
-
-
-
Wait I'm confused? Are you saying the command I'm issuing is fine?
-
-
Wait I'm confused? Are you saying the command I'm issuing is fine?
How exactly would you expect the default graceful reboot command NOT to be fine?
-
I know it's a bit overkill but I used 'systemctl stop kodi' command before reboot in my bash-script.
-
How exactly would you expect the default graceful reboot command NOT to be fine?
This is exactly why I'm asking, do I sound like a linux guru here?
I am unsure of the backend of linux, is it smart enough to send a message saying "I'm shutting down, Kodi, please also shut down and please do it safely" does Kodi then close all open files / handles / stuff in the database?
I don't know, that's why this thread exists I'd like to look after my install and have it long term reliable.
-
- Official Post
Generally a poweroff, reboot or shutdown will close all running programs, wait for them to finish, unmount all files and then shut the system down cleanly.
It is probably a good idea, in a script (as @Jocke.Sve mentioned), to shutdown Kodi and any other "critical programs (mysql etc) prior to issuing a shutdown - especially if there is a lot of file activity.
-
This is exactly why I'm asking, do I sound like a linux guru here?
I am unsure of the backend of linux, is it smart enough to send a message saying "I'm shutting down, Kodi, please also shut down and please do it safely" does Kodi then close all open files / handles / stuff in the database?
I don't know, that's why this thread exists I'd like to look after my install and have it long term reliable.
Well, you'd probably admit it's a reasonable assumption that a standard Linux shutdown command acts gracefully and asks all the processes nicely to terminate and then turns the computer off, wouldn't you? You won't ask the same question if the "Shutdown" menu in Windows is safe, I think...
It's perfectly safe, no worries.
-
You won't ask the same question if the "Shutdown" menu in Windows is safe, I think...
I never (or at least rarely) shut down windows without closing running programs first. Shutting down from the start menu means programs start up automatically in their previous state, and the whole process is noticeably quicker than shutting down programs manually and waiting for their processes to fully stop. It's not unreasonable to suppose something similar might be happening with reboot / poweroff - whether it is or not..
-
Oh you do! There are literally hundreds of processes running under the hood, each of them being gracefully terminated (however funny that sounds) - what you do is you close the running GUI programs. Not all, however - take the taskbar apps as an example (apps running in the clock area): no way you quit each of them separately, I bet you
-
Obvious points are obvious. The fact remains shutting down from the start menu gives a different result to closing programs first. It's not unreasonable to think linux might be similar.
-
Generally a poweroff, reboot or shutdown will close all running programs, wait for them to finish, unmount all files and then shut the system down cleanly.
It is probably a good idea, in a script (as @Jocke.Sve mentioned), to shutdown Kodi and any other "critical programs (mysql etc) prior to issuing a shutdown - especially if there is a lot of file activity.
I want to thank you for your reply but you can also see the contradiction here. Either it's safe, or it isn't? Is it 'aggressive' in it's enforcement of rebooting the machine?
Should I consider "shutdown -r <time period>" instead of "shutdown -r now" for example?
End of the day, I just don't want a corrupt database, / damaged files, the longer this SDCard lasts the better.
P.S I'll be writing a small guide for the community on how to backup a full SDCard for Pi users once this is done.
-
- Official Post
The shutdown will perform exactly the same whether it's "now" or timed.
Personally I shutdown Kodi first, then the computer. But there again, having used "poweroff" for ages, has not caused any issues.
-
I too have always thought that the shutdown command isn't as clean as shutting libreelec down from Kodi GUI.
I have a mini SNES case for my pi and it has built in on/off switch and reset button that connects to gpio.
For a short time I used a script that issued the shutdown -h now command and the shutdown -r command.
I noticed the system would shut down quicker than actually using the shutdown from the Kodi GUI.
Here's what happened.
Using shutdown -h now system would shut down almost instantly.
If I used Kodi GUI to shutdown Kodi from the power menu, I would get the loading circle in the middle of the screen for a couple of seconds before the system would shut down.
So this got me thinking that doing it the proper way through Kodi menu is clearly doing something to Kodi briefly before shutting down (I assume metadata etc)
So I searched the internet for a few hours and found these 2 commands.
kodi-send --action="shutdown"
kodi-send --action="restart"
These are the commands Kodi uses when you shutdown via Kodi power menu and appear to me to do it more cleanly.
So I replaced them commands in my custom shutdown script for my mini SNES pi case power buttons and have felt safer ever since
Might be me being OCD but I feel it's a safer shutdown.
-
Your method has at least one advantage: the system won‘t reboot if kodi thinks it shouldn‘t. For example if a recording on the PVR is running, kodi will show a popup and time out the reboot.
Thanks for the headsup, as i was looking for a nightly reboot solution and have TV-Headend and PVR running on my kodi raspberry.