LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-19-2015, 05:40 PM   #1
trokl
LQ Newbie
 
Registered: Nov 2015
Posts: 3

Rep: Reputation: Disabled
Question How to set CRON job to force reboot at a specified time?


I have tried solutions on a half dozen sites like stack exchange and none of them work.

I tried adding a rule under /etc/crontab, using sudo crontab -e, and placing a file in /etc/cron.d. No luck.

Distro is SUSE 13.2.
Desktop is KDE.

I want to add a cron job in a file under /etc/cron.d. I do not wish to use crontab -e, as I can't even undertand how it works (or why it's not working in this case) and I'd rather just be able to open a file in a GRAPHICAL editor under /etc/cron.d

I want this job to absolutely force REBOOT with a 5 minute notification. I want the reboot to be forced, absolutely nothing stopping it.

I tried it several times without effect.

Last attempt tried to set for 5:17 pm, restarted cron, then waited, and nothing happened.

0 5 17 1/1 * ? * /sbin/reboot

Update: last attempt I created a file zz-reboot in /etc/cron.d and added:

03 18 * * * /sbin/reboot

I waited a few minutes for the clock to catch up and nothing happened.

Thank you kindly.

Last edited by trokl; 11-19-2015 at 06:04 PM. Reason: update
 
Old 11-19-2015, 05:49 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
0 5 17 - it will run 5 AM on 17th.
 
Old 11-19-2015, 05:53 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
http://www.dataphyx.com/cronsandbox/cronsandboxgui.php

Good stuff, Maynard!
 
Old 11-19-2015, 06:06 PM   #4
trokl
LQ Newbie
 
Registered: Nov 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Emerson View Post
0 5 17 - it will run 5 AM on 17th.
The sandbox is a nice idea. I used cronmaker for one command that did not work, then went key one in manually. Still no workie.

03 18 * * * should fire the cron job at 18:03 daily, should it not?

I have repeatedly set the time for the cron a couple minutes ahead of the clock and waited for the clock to catch up. The cron will not execute. I have no idea why.

Last edited by trokl; 11-19-2015 at 07:28 PM. Reason: update
 
Old 11-19-2015, 08:07 PM   #5
trokl
LQ Newbie
 
Registered: Nov 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
Exclamation Solved

I discovered the problem.

The cron system requires a newline at the end of EVERY line in the crontab file.

This means that when editing a crontab, one must press ENTER at the end of the command. Cron will not process a file missing this required newline.
 
  


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
[SOLVED] Force CRON to run a job once again, despite the crontab settings ddsglq Linux - Newbie 4 12-06-2017 10:20 PM
Need help with a scheduled reboot cron job via Webmin torbuck Linux - Newbie 10 06-18-2017 10:56 PM
Cron Job: Start it Only once on specified time jCash Linux - Newbie 2 12-07-2007 07:35 PM
How do I set my profile in CRON job? lolson33 Linux - General 2 12-06-2005 04:18 PM
how to set cron job to run every 5 mins? gsbarry Linux - General 7 05-28-2003 12:30 PM

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

All times are GMT -5. The time now is 04:11 AM.

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