LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-27-2016, 02:12 AM   #1
abhik
LQ Newbie
 
Registered: May 2016
Posts: 3

Rep: Reputation: Disabled
Question How can I set a cron and how can I execute it in Linux?


How can I set a cron and how can I execute it in Linux?
 
Old 05-27-2016, 02:14 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,802

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
man crontab ?
man cron ?
 
1 members found this post helpful.
Old 05-27-2016, 03:09 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
Quote:
Originally Posted by pan64 View Post
man crontab ?
man cron ?
The file format is described in section number 5, and the program itself is described in section number 1. So, "man crontab" by itself will find the section 1 page only, since it is the first. But section 5 is where you'll find the necessary information about how to structure the crontab itself. You'll have to tell "man" explicitly to show the section 5 page, compare:

Code:
man crontab
man 1 crontab
man 5 crontab
man man
One tip is that if you are trying to run a complex chain of programs, it is easier to put them into a script and then call the script from cron.
 
1 members found this post helpful.
Old 05-27-2016, 04:26 AM   #4
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Agreed to what has already been posted. Also, not all GNU/Linux distributions have cron installed by default (Arch Linux for instance).

Best regards,
HMW
 
Old 05-27-2016, 04:55 AM   #5
thorkelljarl
Senior Member
 
Registered: Jun 2008
Posts: 1,820

Rep: Reputation: 229Reputation: 229Reputation: 229
Note...

If you want to use crontab to run commands requiring root, such as shutdown, you may be required to become root before using crontab. I found using su is not sufficient.

You may then have two crontab files with two instances of the cron function running, one set up to run commands requiring root and another for any other command, such as playing a video file at a set time, that you would not want to run as root.

Last edited by thorkelljarl; 05-27-2016 at 04:59 AM.
 
  


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
My oracle server does not execute a script on linux by cron farnaw4u Linux - Server 1 03-06-2010 07:24 AM
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
cron hourly, daily, cron.d jobs don't execute eggsmartha Linux - General 3 09-17-2007 06:37 PM
How to set up cron job to execute bash script lgmqy2000 Linux - General 4 11-22-2006 04:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:35 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