Kodi Community Forum

Full Version: Automated reboot????
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have found that if I leave my system up and running for weeeks on end, then when I return I will either have no audio or no video. A quick reboot fixes the issue.

Is it possible to have some script that would reboot my HTPC once per week or so?
cron and crontab is your friend Smile
OK, that makes sense. I'm not going to act like I know what exactly means though. Is there any chance you could point me in the direction of a good online resource.
I found this in a search, would following these steps get me where I want to be?


Quote:I'd use cron (should already be installed):

Edit crontab:

sudo crontab -e

The first time you might have to choose your preferred editor (like nano)

Insert a line like

0 4 * * * /sbin/shutdown -r +5

at the bottom. Explanation:
m h dom mon dow command
minute hour dayOfMonth Month dayOfWeek commandToRun
so the line
0 4 * * * /sbin/shutdown -r +5
would reboot your system every day at 4:00am.

Ctrl+x - y - enter should get you out of crontab (if using nano)

(2012-03-13, 01:02)FishOil Wrote: [ -> ]This outta get you going.

https://help.ubuntu.com/community/CronHowto

Thanks man. Nothing like a 'lil light reading. I appreciate the help.
(2012-03-12, 22:58)TapRackPull Wrote: [ -> ]I have found that if I leave my system up and running for weeeks on end, then when I return I will either have no audio or no video. A quick reboot fixes the issue.

Is it possible to have some script that would reboot my HTPC once per week or so?

You could do everything you want to within XBMC by using the Cron XBMC addon. You use the same cron syntax as above but the whole process would run within XBMC. You can even go to Programs -> Cron XBMC to see and manually run built in commands.

http://forum.xbmc.org/showthread.php?tid=124888

There are instructions in the README - but the syntax for the reboot command would be:

Code:
<job name="Reboot" expression="0 4 * * *" command="Reboot()" show_notification="false" />

simple put that between the <cron> tags in the cron.xml file (userdata/addon_data/) and it will run whenever XBMC is on. This is also useful for scheduling things like Library updates, Clean Library commands, other addons, etc.
I tried downloading the Cron addon for XBMC but am getting a python script error whenever I try to run it.
(2012-03-13, 05:46)TapRackPull Wrote: [ -> ]I tried downloading the Cron addon for XBMC but am getting a python script error whenever I try to run it.

Sorry if there are issues with it. I downloaded the same zip file and tried it out to see if I could duplicate the problem doing a "from scratch" install. Sadly I didn't encounter any errors after unzipping the file and moving service.cronxbmc into the addons directory. What version of XBMC are you using? I've tested on Eden Beta 3 and RC 2. You'll need above Dharma at the least since this uses the service extension point and that did not exist with Dharma.

Upon running XBMC the addon will automatically start and create the cron.xml file if it does not exist. Please make sure you enter the jobs you want scheduled into this file correctly. The one I made to test looked like this:
Code:
<?xml version="1.0" ?>
<cron>
<job name="Reboot" expression="0 4 * * *" command="RestartApp()" show_notification="false" />
</cron>

I used the RestartApp command because I didn't want my whole system rebooting.

If all of that sounds correct please post a debug log with the error in it. If you are looking through the log you should see an entry "Cron XBMC service starting...." around the beginning of the log when the service starts and then an entry that starts "service.cronxbmc" whenever it posts a message, usually just when it runs a command.
Quote:Sorry if there are issues with it. I downloaded the same zip file and tried it out to see if I could duplicate the problem doing a "from scratch" install. Sadly I didn't encounter any errors after unzipping the file and moving service.cronxbmc into the addons directory. What version of XBMC are you using? I've tested on Eden Beta 3 and RC 2. You'll need above Dharma at the least since this uses the service extension point and that did not exist with Dharma.

Upon running XBMC the addon will automatically start and create the cron.xml file if it does not exist. Please make sure you enter the jobs you want scheduled into this file correctly. The one I made to test looked like this:
Code:
<?xml version="1.0" ?>
<cron>
<job name="Reboot" expression="0 4 * * *" command="RestartApp()" show_notification="false" />
</cron>

I used the RestartApp command because I didn't want my whole system rebooting.

If all of that sounds correct please post a debug log with the error in it. If you are looking through the log you should see an entry "Cron XBMC service starting...." around the beginning of the log when the service starts and then an entry that starts "service.cronxbmc" whenever it posts a message, usually just when it runs a command.

Perhaps, the reason I am having issues with the add-on is that I don't fully understand how to install it? I was of the impression that you downloaded the .zip and then enabled it. What are you referring to when you say "moving service.cronxbmc into the addons directory".

Otehrwise, I am using Dharma 10.1. And I will post a debug log as soon as I can, but you will need to be a tad patient with me as I work full time and take night classes. So, it might be tomorrow evening or even Friday before I can do that.

I appreciate everyone's help.
(2012-03-13, 19:53)TapRackPull Wrote: [ -> ]Perhaps, the reason I am having issues with the add-on is that I don't fully understand how to install it? I was of the impression that you downloaded the .zip and then enabled it. What are you referring to when you say "moving service.cronxbmc into the addons directory".

Otehrwise, I am using Dharma 10.1. And I will post a debug log as soon as I can, but you will need to be a tad patient with me as I work full time and take night classes. So, it might be tomorrow evening or even Friday before I can do that.

I appreciate everyone's help.

Whenever you have time to look at your system I'll try to help as you need it.

You can install the addon two ways. One would be using the "install from zip file" option within XBMC, the other would be extracting the file manually and moving it to the addons directory with all the other addons. Both work the same, using the option within XBMC under the Settings->Addons menu is probably the easiest. Sounds like that is the one you used to install it.

This addon will definitely not work with Dharma however; that may even be the cause of the errors you are seeing since the "service" extension point does not exist. If you are looking to keep with Dharma until Eden is released then you'll have to use a method outside of XBMC as described in some of the other posts. If you upgrade your system to Eden RC2 then this addon will work for you.
A-HA!!!
Well that would explainthe CRON issue.

I have been waffling on upgrading now vs waiting for Eden stable...