LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 07-13-2006, 12:13 AM   #1
RemusX2
Member
 
Registered: Oct 2003
Location: Bozeman, Montana
Distribution: Gentoo 2010, Ubuntu 9.04
Posts: 175

Rep: Reputation: 30
Crontab Problems


I'm trying to do my first Crontab entry and I am not having anyluck =[

Here's what I got : I want the computer to shutdown on day X at time X

Here's the Crontab entry
Code:
0 1 * * 0,1,2,3,4       shutdown -h now
30 2 * * 5,6            shutdown -h now

I have been testing it with
Code:
X X * * * reboot
where the X's are the upcoming minutes.

Where am I going wrong?

Thanks
 
Old 07-13-2006, 01:18 AM   #2
majalee
Member
 
Registered: Jul 2004
Location: India
Distribution: Ubuntu / OpenSuse
Posts: 54

Rep: Reputation: 15
the first question is whether u are doing this as a 'user' or as a 'root'. if u r doing this as a 'root' u will not have any trouble. but as a 'user' do u have permissions to execute 'shutdown' and 'reboot'. if u do not have permissions, your crontab wouldn't work.

aaditya
 
Old 07-13-2006, 01:40 AM   #3
RemusX2
Member
 
Registered: Oct 2003
Location: Bozeman, Montana
Distribution: Gentoo 2010, Ubuntu 9.04
Posts: 175

Original Poster
Rep: Reputation: 30
The machine that those cron entries are active, I am running Ubuntu and root is disabled. I did issue
Code:
sudo crontab -e
in order to add the entry... so this should all be working then?
Would it require me restarting the cron service?

Thanks
 
Old 07-13-2006, 02:37 AM   #4
zidane_tribal
Member
 
Registered: Apr 2005
Location: chained to my console.
Distribution: LFS 6.1
Posts: 143

Rep: Reputation: 18
go to a console. type 'shutdown' and press enter. read what the result is.

i suspect what you need to be doing is 'sudo shutdown', whilst ubuntu has no concept of a root account, the linux software that you are trying to use *does* require root priveledges. after a quick fiddle on a local box, you can jink with sudo to not require a password from you, then use sudo shutdown in your cron. you should probably be able to tinker with cron and get a root or system crontab.

why are you wanting to turn the machine off anyways? i'm curious.
 
Old 07-13-2006, 05:13 AM   #5
doc.nice
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Debian
Posts: 274

Rep: Reputation: 34
you will need "sudo shutdown -h", but check the manpage for anacron, because this little helper calls any jobs that weren't executed at the scheduled time because the system was powered down or anything else. So if you turn of your system at 1.00 and hav set the cronjob to do it on 1.30, the next time you boot, anacron will detect the missed job and will execute it...

maybe a litte script that checks the $(date) and compares it with preset dates will do better. This script should be called by cron.

hth,
Flo
 
Old 07-13-2006, 10:08 AM   #6
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
One of the reasons that I am loth to try *buntu is the non-standard treatment of root.

BTW, I believe that it's not that these distros "has no concept of a root account", it's that root is effectively disabled by not having a password in the default configuration.

That said, here are the fixes I have heard about:
Code:
# Permanently enable "normal" root:
sudo passwd

# Start a root terminal session:  
sudo su
 
  


Reply



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
Problems with crontab haddad Linux - Software 4 01-18-2006 01:09 PM
problems with crontab p.gaic Linux - Software 7 07-25-2005 05:36 AM
problems setting the user in crontab p.gaic Linux - Software 1 07-14-2005 11:07 PM
crontab problems dshafi Linux - General 1 08-19-2004 02:51 AM
problems with crontab for root reqvidd Linux - Newbie 2 11-10-2003 07:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration