LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-28-2011, 04:08 PM   #1
KimF
LQ Newbie
 
Registered: Aug 2009
Location: Skovballe, Denmark
Distribution: Ubuntu, Gentoo, Redhat, Maemo
Posts: 11

Rep: Reputation: 0
Hibernate from cron


Hi

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/hibernate.sh) 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/hibernate.sh does exist, and I can run it from a terminal as root.

Any ideas ?

Kim
 
Old 06-28-2011, 04:22 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
@ Reply

Hi Kim,

Try the following steps:

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

cd /etc/acpi
./hibernate.sh

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 hibernate.sh file. I think the best way to work with cron is to create script and automate using cron.

I hope this helps.

Last edited by T3RM1NVT0R; 06-28-2011 at 04:23 PM.
 
Old 06-28-2011, 04:45 PM   #3
KimF
LQ Newbie
 
Registered: Aug 2009
Location: Skovballe, Denmark
Distribution: Ubuntu, Gentoo, Redhat, Maemo
Posts: 11

Original Poster
Rep: Reputation: 0
Hi

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

I can run /hibernate as root.

Kim
 
Old 06-28-2011, 06:05 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
@ Reply

Try this:

In crontab put the following line 50 22 * * * sh /hibernate
 
Old 06-28-2011, 06:59 PM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,264

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
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
Code:
set -xv
to the script to get a debug output.
 
Old 06-29-2011, 02:59 PM   #6
KimF
LQ Newbie
 
Registered: Aug 2009
Location: Skovballe, Denmark
Distribution: Ubuntu, Gentoo, Redhat, Maemo
Posts: 11

Original Poster
Rep: Reputation: 0
Hi

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 hibernate.sh at the appropriate time, and it works.

But thanks for the help anyway.

Kim
 
  


Reply

Tags
cron, crontab, hibernate, root


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Cron directories: /var/spool/cron/cron.GfqqGO Woodsman Slackware 4 05-11-2011 02:37 PM
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 08:57 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
cli hibernate works but gnome panel hibernate fails BCarey Linux - Desktop 1 06-08-2007 10:21 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U Suse/Novell 11 01-04-2007 01:57 AM


All times are GMT -5. The time now is 02:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration