Modify hour crontab UNIX


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Modify hour crontab UNIX
# 1  
Old 11-27-2013
IBM Modify hour crontab UNIX

Hello,

I wish to modify the day of launch of a "batch" in the crontab on several servers with awk or sed.
Can you help me ?

Beforehand thank you

Code:
00 18 * * 1 /box/Pra/bin/systeme_reverse.ksh -s >/dev/null 2>&1

# 2  
Old 11-27-2013
Code:
00  18  *  * 1 /box/Pra/bin/systeme_reverse.ksh -s >/dev/null 2>&1

Day of week = 0 == Sunday 1== Monday .... 6 = Saturday. 1,3 == Monday and Wednesday, so, 1 == Monday.

* == means any value.


If you want an exact setting verified please tell us what you want.
http://en.wikipedia.org/wiki/Cron

Your crontab example runs every Monday at 1800 (6pm). To change the hour change 18 to 12, to move from 6pm to noon.

Last edited by jim mcnamara; 11-27-2013 at 09:14 AM..
# 3  
Old 11-27-2013
I have to modify many entries in crontab for this line.
I would like to change the day with a script shell by ssh command with a awk or sed command.

Thank you for your response

Last edited by jim mcnamara; 11-27-2013 at 09:28 AM..
# 4  
Old 11-27-2013
And you believe that modifying the line, will suffice for cron to update? What OS are you using?
# 5  
Old 11-27-2013
Just saw your IBM icone so:
I appended to my crontab in /var/spool/cron/crontabs (as root...)
Code:
#   monitor activity and mail if issues
00,15,30,45  *  *  *  *  /sm/cron/bin/monit_sys >/sm/cron/log/monit_sys.log 2>&1
# ==========================================================================
36 15 * * *  /home/vbe/test_cron_cmd > /home/vbe/cron.log 2>/home/vbe/cron.err
na12:/home/vbe $ date
Wed Nov 27 15:35:47 CET 2013
na12:/home/vbe $ date
Wed Nov 27 15:35:53 CET 2013
na12:/home/vbe $ date
Wed Nov 27 15:35:57 CET 2013
na12:/home/vbe $ r ll
ll cron.*
-rw-r--r--    1 vbe      bin              74 Nov 27 15:30 cron.err
-rw-r--r--    1 vbe      bin              12 Nov 27 15:30 cron.log
-rw-r--r--    1 vbe      bin              14 Nov 27 15:30 cron.out
na12:/home/vbe $ date
Wed Nov 27 15:36:04 CET 2013
na12:/home/vbe $ r ll
ll cron.*
-rw-r--r--    1 vbe      bin              74 Nov 27 15:30 cron.err
-rw-r--r--    1 vbe      bin              12 Nov 27 15:30 cron.log
-rw-r--r--    1 vbe      bin              14 Nov 27 15:30 cron.out
na12:/home/vbe $ oslevel
7.1.0.0

For the rest if you have so many changes the easiest would be to remove the line and append...
# 6  
Old 11-27-2013
Hi,
I have oslevel AIX 6.1.
I just want to change the day of the script in crontab file for 60 servers with ssh

Thank you
# 7  
Old 11-28-2013
Where exactly do you have a problem? The sed-script? The way cron works? The ssh-communication?

I still don't understand what exactly you need to be helped with, please elaborate.

I hope this helps.

bakunin
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crontab error - bad hour

Hi All, While setting the crontab i am getting the below error, "/tmp/crontab.XXXXwKymEc" 156L, 15621C written crontab: installing new crontab "/tmp/crontab.XXXXwKymEc":74: bad hour Please help. Thanks (2 Replies)
Discussion started by: nag_sathi
2 Replies

2. Shell Programming and Scripting

E-mail based on crontab hour

I have a cron: 0 5,11,17,23 * * * /home/oracle/scripts/sysize.ksh This cron will trigger cat dbsz.txt | mail -s "$TODAY: PROD DB Size" $RECIPIENTS I don't want to get the e-mail notice 4 times a day. Can I have just one e-mail triggered at 11 AM? Please advise. Thank you (3 Replies)
Discussion started by: Daniel Gate
3 Replies

3. Solaris

Solaris 9 Zone : Date command in crontab shows delayed(One Hour) output

SOLARIS 9 Zone : date command in crontab shows delayed(One Hour) output Hi folks, the date command shows the correct date and time, How ever, if the date command executed through crontab in any form of scrip the output shows as one hour delayed, similar to date -u.. Can some one help in... (12 Replies)
Discussion started by: judi
12 Replies

4. UNIX for Dummies Questions & Answers

Crontab not working with the hour configuration

Hi, When I set the crontab to run every minute, every hour, it works fine. * * * * * env > /tmp/env.output However I want to run it every day at 8:00 AM and it does not run. * 8 * * * env > /tmp/env.output I ran the 'date' command which says it's 8AM PST and also the 'TZ'... (5 Replies)
Discussion started by: samantha13
5 Replies

5. AIX

crontab 1 hour off from current time

This is a new one on me. We upgraded a system from AIX 5.3 TL 7 to 6.1 TL 7 yesterday. The app people notified us that their cron jobs weren't running at the right time. So I made a test cron entry and here's what I've found: # crontab -l * * * * * /usr/bin/date > /tmp/test.log 2>&1 # cat... (2 Replies)
Discussion started by: homeyjoe
2 Replies

6. Shell Programming and Scripting

To Run a job every hour without using crontab

Hi, Can anyone help me in finding how to run a specific job every hour without using crontab. Say for example i need to run a command ps -aux in the starting of every hour.. (3 Replies)
Discussion started by: glv
3 Replies

7. Shell Programming and Scripting

Sed or Awk for modify hour in a crontab AIX

Hi, I want to modifiy the hour in the crontab AIX 5.3 for this line: Input: 00 22 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1 Output: 30 20 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1 With the awk or sed function through a ssh -q... (1 Reply)
Discussion started by: khalidou13
1 Replies

8. Shell Programming and Scripting

Crontab for every minute or every hour

How to set crontab for every minute or every hour (1 Reply)
Discussion started by: kaushik02018
1 Replies

9. Shell Programming and Scripting

Modify crontab file on many hosts...

Hi everyone taking a second to read this :D, I need to modify a line from the root crontab file... Usually, if I need to do this I use the crontab -e, which opens up the file with Vi, then I edit it and there's no problem. Now, I need to do this but on many servers at the same time... Like in... (3 Replies)
Discussion started by: Casey
3 Replies

10. UNIX for Dummies Questions & Answers

Using a script to modify the crontab

I want to add one line to the end of my crontab using a script. I have tried piping in the editor commands, but I can't get it to work. crontab -e user << EX $a This is the text I want to add. . wq EX This doesn't work. Is there an easier way to do this? (2 Replies)
Discussion started by: johnmsucpe
2 Replies
Login or Register to Ask a Question