LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-02-2012, 11:52 AM   #1
malak33
Member
 
Registered: Dec 2011
Location: Amish Country PA, USA
Distribution: CentOS 6.2
Posts: 104

Rep: Reputation: 3
Crontab question


so i was wondering if i could create a cron job by just adding a file called testcron under the /etc/cron.d/cron.daily directory or do i need to use crontab -e in order to create a cron job. I would be using Centos as an OS and as root. Thanks in advance.
 
Old 12-02-2012, 12:15 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
/etc/cron.d/cron.daily ... Strange!! Is really there any directory named cron.daily? I know cron.deny, but not cron.daily.
Anyway, you can use crontab and add as many as jobs in it.

To edit crontab, use:
Code:
crontab -e
And to check your scheduled jobs in crontab:
Code:
crontab -l
Make entries in following format:
Quote:
Minute Hour Day_of_month Month Day_of_week Command

Last edited by shivaa; 12-02-2012 at 12:17 PM.
 
Old 12-03-2012, 01:23 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
FYI
Code:
ll /etc |grep cron
-rw-r--r--.  1 root root    541 Jul 19  2011 anacrontab
drwxr-xr-x.  2 root root   4096 Nov 21 10:45 cron.d
drwxr-xr-x.  2 root root   4096 Nov 27 11:39 cron.daily
-rw-r--r--.  1 root root      0 Jul 19  2011 cron.deny
drwxr-xr-x.  2 root root   4096 Nov 21 10:46 cron.hourly
drwxr-xr-x.  2 root root   4096 Nov 21 10:45 cron.monthly
-rw-r--r--.  1 root root    457 Sep 27  2011 crontab
drwxr-xr-x.  2 root root   4096 Sep 27  2011 cron.weekly


In any case, those should really only be used for system cronjobs.
For individual user's cronjobs (inc root), use
Code:
crontab -e
 
  


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
crontab question struct Linux - Newbie 3 06-15-2011 07:20 PM
Crontab Question systemhackerz Red Hat 4 06-28-2006 12:02 AM
crontab question kaplan71 Linux - General 4 07-18-2005 04:04 PM
crontab question WeNdeL Linux - Newbie 1 03-06-2003 10:24 AM
Crontab Question linear Linux - Software 4 01-11-2003 02:42 AM

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

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