Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 8th June 2012, 01:57 AM
BenTrein's Avatar
BenTrein Offline
Registered User
 
Join Date: Sep 2008
Location: Thailand
Age: 36
Posts: 355
linuxopera
Cron missing in Fedora 17

I need to shutdown my machine automatically at 20:00 - whether I'm home or not. So I added this line to /etc/crontab :
Code:
0 20 * * * * /sbin/shutdown -h now
This worked under F16. Then I went to restart the cron-daemon with
Code:
/etc/init.d/cron restart
-bash: /etc/init.d/cron: No such file or directory
Er what?? Where is cron hiding in F17? Quick check says indeed there's no such thing as cron in /etc/init.d. There's only 0hourly, raidcheck and smolt.

Where is cron, and if something went wrong during the installation how do I get it back? I'm assuming I could gedit the text into place, but I have no idea what it should say...
__________________
Greetz (and thanks for all the help!)
BenTrein

The internet isn't a highway, it's a swamp. The more you surf the more it draws you in!

Great authors suffer from Writer's Block. I cherrish my Writer's Blog!
Reply With Quote
  #2  
Old 8th June 2012, 02:22 AM
scott32746 Offline
Registered User
 
Join Date: Jun 2007
Location: Lake Mary, Florida
Age: 48
Posts: 1,082
linuxfirefox
Re: Cron missing in Fedora 17

Hello,

Best to just get to root
then do
# crontab -e
add your shutdown line
save it

But you could try
# systemctl restart crond.service
Reply With Quote
  #3  
Old 8th June 2012, 05:49 AM
BenTrein's Avatar
BenTrein Offline
Registered User
 
Join Date: Sep 2008
Location: Thailand
Age: 36
Posts: 355
linuxfirefox
Re: Cron missing in Fedora 17

Yeah, that did the trick - with a test time of 11:37.
It's 11:47 and when I turn it back on, it won't stay on for more than a minute... :S Any thoughts?
__________________
Greetz (and thanks for all the help!)
BenTrein

The internet isn't a highway, it's a swamp. The more you surf the more it draws you in!

Great authors suffer from Writer's Block. I cherrish my Writer's Blog!
Reply With Quote
  #4  
Old 8th June 2012, 02:05 PM
scott32746 Offline
Registered User
 
Join Date: Jun 2007
Location: Lake Mary, Florida
Age: 48
Posts: 1,082
linuxfirefox
Re: Cron missing in Fedora 17

need more info

is it just going down or is it doing a nice shutdown ?

/etc/cron is not where you put cron jobs. I would remove anything you have added there

if you where to add manully it would be in /var/spool/cron/USER_ID

Last edited by scott32746; 8th June 2012 at 02:41 PM.
Reply With Quote
  #5  
Old 8th June 2012, 03:15 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,105
linuxfirefox
Re: Cron missing in Fedora 17

There are only 5 time and date fields, your entry is showing 6.

Is that just a typo? As the sixth field is the command to run (in your case, it starts with an *...
Reply With Quote
  #6  
Old 9th June 2012, 06:29 AM
BenTrein's Avatar
BenTrein Offline
Registered User
 
Join Date: Sep 2008
Location: Thailand
Age: 36
Posts: 355
linuxopera
Re: Cron missing in Fedora 17

I found that detail too (the typo) - and fixed it. I've also learnt how to use vi-editor, but man - can this not be modernised? It is sooo 1980s!

I've now typed # crontab -e
Code:
 0 18 * * * /sbin/shutdown -h now
That is supposedly the way it works. It did shut down at 18:00, but I didn't try to boot it up again till this morning - and it booted fine. I am thinking that it may have to do with the type (thank you jpollard for pointing that out).

scott: If I stick things in /var/spool/cron/USER_ID - does it still shut down? Or is it user dependent? One needs to be root to shut down even though others are logged in...

Then another thing - I'm trying to get Zenity to post a message warning of shutdown 20 minutes, and 10 minutes before shutdown. So I've created a file called /home/sd.sh and gave it chmod 755. The content of this file looks like this:
Code:
#!/bin/bash

zenity --warning \
--text="This computer will shutdown soon! Save your work."
This file works fine if I type: $ ./home/sd.sh

Then I added this through crontab -e
Code:
40,50 17 * * * /home/sd.sh
But I suspect something is wrong with that line, because it doesn't get executed... Any hints are welcome.
__________________
Greetz (and thanks for all the help!)
BenTrein

The internet isn't a highway, it's a swamp. The more you surf the more it draws you in!

Great authors suffer from Writer's Block. I cherrish my Writer's Blog!
Reply With Quote
  #7  
Old 9th June 2012, 12:28 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,105
linuxfirefox
Re: Cron missing in Fedora 17

If the user is root it works fine.

Note: shutdown has a time option that sends out timed messages already built in.

As far as the script not executing - that will likely be due to not having the full path to the file.

Note the difference between "./home/sd.sh" and "/home/sd.sh" which requires the current working directory to have a directory named "home" in it.

If this is in the root account (it should be) then it would be "/root/home/sd.sh" or "/root/sd.sh".

Last edited by jpollard; 9th June 2012 at 12:31 PM.
Reply With Quote
Reply

Tags
cron, fedora, missing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No output from cron jobs in /etc/cron.daily marriedto51 Using Fedora 3 3rd February 2011 11:57 AM
Cron contents missing hepkat63 Using Fedora 2 5th February 2005 03:42 AM
Missing Cron? PeterT Using Fedora 4 20th October 2004 03:39 AM


Current GMT-time: 11:32 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat