How to View multiple Cron jobs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to View multiple Cron jobs
# 1  
Old 07-31-2011
Computer How to View multiple Cron jobs

Hi,
I ran two crontab commands
using:
crontab program1
crontab program2

However when I type crontab -l only the second cron job shows up, how do I see all cron jobs running and how do I edit all at the same time
Thanks in Advance
SSmilie
# 2  
Old 07-31-2011
Quote:
I ran two crontab commands
You don't run crontab commands. Crontab runs the commands.
You set the scheduling by issuing
Code:
crontab -e

which will load the crontab into editor of your choice (you can change the editor by 'select-editor' later on), and you specify what should run when. You can, of course have many different programs scheduled.

Root can set the crontab for ohter users as well, by doing
Code:
crontab -e -u user1

As you already know, you view the contents of crontab by
Code:
crontab -l

Man pages are your friend!
# 3  
Old 07-31-2011
HI Mirni,
I guessed I used the wrong choice of words, "schedule" crontab is the right word, and that is what I did, but my question is still not answered,

Here is the question again:

Why does crontab -l command always show only the "latest scheduled" cron job, I wish to display all cronjobs that have been scheduled not just the latest one. How do you do this?
# 4  
Old 07-31-2011
@walforum
Code:
crontab -l

Just display all crons per user which you are logged in with , It will display all crons in your crontab file not the last only.
if you run
[CODE]
$ EDITOR=vi
$ crontab -e
[0/CODE]
and shows many entries just post here again
If you want to display all cron jobs for all users you have to have root access and try something like this
Code:
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done

or

Code:
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done

# 5  
Old 07-31-2011
Computer

Thanks for your reply
How about if the logged in user has say about ten different crons scheduled and wants to see them all,
crontab -l only shows the tenth one out of the ten cron jobs, how do you view the first nine.
# 6  
Old 07-31-2011
what flavor of UNIX you are using
issuing crontab -l command for a user will show all entries by default

---------- Post updated at 10:58 PM ---------- Previous update was at 10:43 PM ----------

anyways try the following command
crontab -u $USER -l
# 7  
Old 07-31-2011
Hi,
I Use a MAC OS x 10.6.8
I need administrative rights to use -u option which I don't have right now, but Thanks anyway.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to run multiple cron jobs?

I have two scripts which I'm tying to run one after the other- this is what I've tried: 00 14 * * * /path/one.sh && /path/two.sh I've also tried putting each script on a different line: 00 14 * * * /path/one.sh 00 14 * * * /path/two.sh Can this be done? (1 Reply)
Discussion started by: $shell_Learner
1 Replies

2. Shell Programming and Scripting

How to view the cron jobs that ran on kinit i keep getting must be privileged to use -u?

How to view the cron jobs that ran on kinit i keep getting must be privileged to use -u this is the control used, echo 'cat /usr/local/bin/tpthadoop/secret/hadoop.txt' | kinit hdfs what happens with above command kinit is using kerberos and the account used to run the processes jobs are... (1 Reply)
Discussion started by: cplusplus1
1 Replies

3. Shell Programming and Scripting

Shell script to run multiple jobs and it's dependent jobs

I have multiple jobs and each job dependent on other job. Each Job generates a log and If job completed successfully log file end's with JOB ENDED SUCCESSFULLY message and if it failed then it will end with JOB ENDED with FAILURE. I need an help how to start. Attaching the JOB dependency... (3 Replies)
Discussion started by: santoshkumarkal
3 Replies

4. Solaris

Cron jobs and at jobs

There are two jobs in Solaris , Cron and at jobs.. I know how to disable or enable cron jobs. How can I enable at jobs and disable it. Kindly help. Rj (2 Replies)
Discussion started by: jegaraman
2 Replies

5. UNIX for Dummies Questions & Answers

cron jobs

Hi, We have a group of hosts using which the cron jobs are submitted... Few days ago i had submitted a cron job in of these hosts, but unfortunately forgot the host name :( Can anyone please help me out in finding this host name from which the cron s submitting the job, i dont want the... (2 Replies)
Discussion started by: bhavanisree
2 Replies

6. UNIX for Advanced & Expert Users

cron jobs...

I need to start a job every friday night at 8:00 P.M , it runs all the day on Sat and Sun....can somebody tell me how to do this...I understand crontab...but haven't used it.........can u write some steps.....how to create a file and call.....I honestly dont know? Plz help.Thanks (2 Replies)
Discussion started by: RubinPat
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. AIX

comment jobs in cron for multiple accounts

Hi, We have several jobs scheduled in cron in AIX. Before every release we need to comment those jobs and uncomment those after the release is over. There are several accounts whose cron entries need to be commented. Can anyone provide me with a script which can put a '#' before each line in... (3 Replies)
Discussion started by: shibajighosh
3 Replies

9. HP-UX

Cron jobs

i am new for cronjobs can someone please tell me what logic is behind these RED Numbers and stars below? --> crontab -l 00 1 * * * /home/scripts/TarprodContent > /tmp/MprodBkup.log 2>&1 00 1 * * * /home/scripts/TarTprodContent > /tmp/TprodBkup.log 2>&1 00 1 * * *... (5 Replies)
Discussion started by: ajadaun
5 Replies

10. UNIX for Advanced & Expert Users

cron jobs

I need to monitor my cron jobs with another unix machine since occasionally the cron will go down on the main server but there are no errors. Can anyone help with a script to write to use the cron on the back up machine to monitor the main server? I am using SCO and the cron jobs have been... (3 Replies)
Discussion started by: rmarral
3 Replies
Login or Register to Ask a Question