Editing a cron file with crontab


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Editing a cron file with crontab
# 1  
Old 03-03-2010
Editing a cron file with crontab

I want to set up a file with crontab to run the cron deamon so I can use at to schedule jobs. I think the crontab file (or whatever you call it) has to be set up. Currently, I don't have a crontab file (I checked by typing sudo crontab -u myusername -l), and I don't know the syntax for creating one. I need to create one that allows at to be run. At the moment at doesn't work. Are there any sources that give information about using crontab or cron? I've tried the man pages and Wikipedia, but neither of them has provided any answers.
# 2  
Old 03-03-2010
Try the following way for creating the crontab. If you have crontab file already it will open the existing file. Otherwise it will create new crontab file.

Code:
crontab -e

It will open the cron file with following line.
# m h  dom mon dow   command

# 3  
Old 03-04-2010
Quote:
Originally Posted by Nila
Try the following way for creating the crontab. If you have crontab file already it will open the existing file. Otherwise it will create new crontab file.

Code:
crontab -e

It will open the cron file with following line.
# m h  dom mon dow   command

I already know how to create a crontab file. What I want to know is what to put into the file to set it up so that I can use at.
# 4  
Old 03-04-2010
Try the following example.

Code:
* * * * * ls   # This line will execute the 'ls' command at every time for every day.

If you want better understanding try the following link.
Link : Crontab – Quick Reference.
# 5  
Old 03-04-2010
MySQL

Code:
crontab -e

Crontab -e option is used to edit the crontab file. if the file already exist then it will open the existing file otherwise it will create a new file in your /tmp directory.
-l option is used for to list the crontab entries
-r option is used for to remove the crontab entries

crontab entry format:

m h dom mon dow command


* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
# 6  
Old 03-04-2010
The crontab file has nothing to do with at. at and cron can be configured separately to be allowed or denied for users.
# 7  
Old 03-04-2010
I found that link helpful and have been able to successfully set up a crontab file. Thank you for your replies.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Crontab editing issue

Hi, OS - SunOS I gave crontab -e then it returns zero. $ crontab -e 0 ? ? Crontab status - $ ps -ef | grep cron root 2481 1 0 May 12 ? 0:18 /usr/sbin/cron Please help (9 Replies)
Discussion started by: nag_sathi
9 Replies

2. Shell Programming and Scripting

Editing crontab via ksh

Hi all, I am trying the following I am hoping that the crontab would be changed. but it prints the previous crontab and says Can anyone tell me the correct ksh command that should be used here? I don't want to edit the crontab with crontab -e, I need to edit it via ksh. Thank... (2 Replies)
Discussion started by: ajaba
2 Replies

3. UNIX for Dummies Questions & Answers

Editing crontab of non-root user from file

Hi All, Ref: "build crontab from a text file" in same forum. (I am not allowed to post URL's in the first post) We are reorganizing our UNIX Crontab file by first making changes in a word pad text file. The intent is to then copy it back to Crontab. Will this work? Copy and Paste does not... (6 Replies)
Discussion started by: nivedhitha
6 Replies

4. Shell Programming and Scripting

Cron on Solaris not editing.

I am working on Solaris machine. I have to add a cron for some operation, nut in SSH terminal crontab -l shows all related crons, but crontab -e instead of opening vi editor shows some number. Could any body tell what can be issue? (16 Replies)
Discussion started by: nixhead
16 Replies

5. Fedora

editing crontab help

I'm using fedora 5 and sql 5.0. I'm trying to edit the crontab to perform automatic backups of my database. For some reason it isn't working. Here is what I have so far. 15 2 * * * /usr/bin/mysqldump -opt -all-databases u root -ppassword -h localhost... (10 Replies)
Discussion started by: randerson21
10 Replies

6. Solaris

editing crontab with vim and using .vimrc

Hi since we migrated from Solaris 8 to Solaris 10 I do miss a nice feature when editing crontab with vim editor: no more color highlighting after starting to edit. Well there is a hack, see below. I did define: export EDITOR='vim -c ":source /export/home/duc904/.vimrc"' Under Sol8 when... (2 Replies)
Discussion started by: duc904
2 Replies

7. UNIX for Dummies Questions & Answers

Re : Set multiple cron jobs in one crontab file

Hello All, Hopw all is fine. I am newbie to Unix. I am using Bourne Shell (sh). One of the question I have is that I am trying to read XML file and based on reading that XML file I want to run different java programs at different hours. Meaning 05 14 * * * java ./program1 10 14 * * * java... (3 Replies)
Discussion started by: samshaw
3 Replies

8. Shell Programming and Scripting

Editing Crontab

Hi I am not able to edit crontab. Following is the comand that is being issued $crontab -e 2764 ............ This is what I am able to see But when I do $crontab -l List of all the crontab entry is displayed. Also I am seeing one entry in my /etc/cron.d prw------- 1 root ... (6 Replies)
Discussion started by: pankajkrmishra
6 Replies

9. Solaris

editing cron

im running crontab -e as root, I keep getting, I set my editor to EDITOR=vi... # crontab -e 477 (2 Replies)
Discussion started by: csaunders
2 Replies

10. UNIX for Dummies Questions & Answers

Editing a CRON file

Hi, I am accessing CRON via telnet and want to set up some jobs. I have typed crontab -e to edit my cronfile but I can't seem to enter anything when I type on my keyboard. All I have is a flashing cursor at the top with ~ on the start of each line. How can I enter the jobs and save this... (9 Replies)
Discussion started by: jaffy1229
9 Replies
Login or Register to Ask a Question