-   Linux - Software (
-   -   Hibernate from cron (

KimF 06-28-2011 05:08 PM

Hibernate from cron

I'm trying to make my media center (Ubuntu 10.10 with XBMC 10.1) hibernate automatically.

I have added a task to cron (something like 50 22 * * * /etc/acpi/ as root, and sudo crontab -l displays the task as expected.

But when cron tries to run the task it logs the following error in syslog : grandchild (#xxxxx) failed with exit status 127

/etc/acpi/ does exist, and I can run it from a terminal as root.

Any ideas ?


T3RM1NVT0R 06-28-2011 05:22 PM

@ Reply
Hi Kim,

Try the following steps:

1. vi /hibernate
2. Put the following lines in this file:

cd /etc/acpi

3. Save the file and exit
4. chmod 755 /hibernate (Make it 777 if you want to make it available for all
5. In crontab put the following line 50 22 * * * /hibernate

And the reason I can think of why you getting that message is because the path you have given in crontab is unable to locate the file. I think the best way to work with cron is to create script and automate using cron.

I hope this helps.

KimF 06-28-2011 05:45 PM


Thanks for the reply, unfortunately that gave exactly the same result :scratch:

I can run /hibernate as root.


T3RM1NVT0R 06-28-2011 07:05 PM

@ Reply
Try this:

In crontab put the following line 50 22 * * * sh /hibernate

chrism01 06-28-2011 07:59 PM

Given that cron has a minimal env eg $PATH, maybe it's a cmd inside the script that has the issue? Ensure you are using the full path to all cmds & files referenced in the script.

Also, add

set -xv
to the script to get a debug output.

KimF 06-29-2011 03:59 PM


Thanks for the answers.

I have been examining the hibernate script, and it does call pm-hibernate without paths, so that probably is the cause of the 127 status.

I'm not much for modifying the script as it is a system script.

I have solved the problem by modifying a daemon, one I was using in the project anyway, to call at the appropriate time, and it works.

But thanks for the help anyway.


All times are GMT -5. The time now is 03:36 AM.