The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cron cannot create the file. surekha268 UNIX for Advanced & Expert Users 2 09-02-2008 02:36 AM
cron cannot create the file.. surekha268 Shell Programming and Scripting 0 09-02-2008 01:45 AM
create a chmod cron job help please sirj Shell Programming and Scripting 2 04-19-2008 08:03 AM
How to create a cron job and run in quality system mahantysk HP-UX 2 03-26-2008 02:23 AM
How to create cron job automatically? siegfried Shell Programming and Scripting 0 04-26-2006 01:01 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-09-2008
samshaw samshaw is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 16
Re : How to create this cron job?

Hello All,

Hope this finds you well. I am creating this shell script that will create cron jobs in crontab file. What I am provided with is the start time , intervals and # of trials. Based of Start time ( say 7:15 am ) and interval being 15 minutes, # of trial being 5 , I should create cron job with following time ...

07:15 07:30 07:45 08:00 08:15

now I would create cron job for this time requirement as ...

15,30,45,00 07,08 * * * command.....

But above would also run command at 07:00 , 08:30, 08:45 ....which is not required. I am using Bourne Shell (sh) . Would appreciate your help in this regards. Let me know if I missed on some.

Thanks,
Sam
  #2 (permalink)  
Old 12-09-2008
ThobiasVakayil ThobiasVakayil is offline
Registered User
  
 

Join Date: May 2006
Posts: 64
create the cron job with two lines :

15,30,45 07 * * * command.....
00,15 08 * * * command.....
  #3 (permalink)  
Old 12-09-2008
samshaw samshaw is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 16
Quote:
Originally Posted by ThobiasVakayil View Post
create the cron job with two lines :

15,30,45 07 * * * command.....
00,15 08 * * * command.....
Hello ThobiasVakayil,

So besides spliting them into 2 lines, there is not other solution ....is this correct ?

Thanks,
Sam
  #4 (permalink)  
Old 12-09-2008
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
Quote:
Originally Posted by samshaw View Post
So besides spliting them into 2 lines, there is not other solution ....is this correct ?
If you insist on having one line only in cron you could create an intermediary script which starts your job at the correct times using the "at"-command. This script could be invoked by cron. Crontab would look like this:

Code:
15 7 * * * * my_startscript.sh
and my_startscript.sh would look like this:

Code:
#!/bin/sh

echo "/my/app -options" | at now
echo "/my/app -options" | at now + 15 minutes
echo "/my/app -options" | at now + 30 minutes
echo "/my/app -options" | at now + 45 minutes

exit 0

I hope this helps.

bakunin
  #5 (permalink)  
Old 12-09-2008
ThobiasVakayil ThobiasVakayil is offline
Registered User
  
 

Join Date: May 2006
Posts: 64
I think it is the solution.
B'cos there is no match between the minutes entry.
  #6 (permalink)  
Old 12-09-2008
surekha268 surekha268 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 8
Its not possible in any way.
In single line we cant give the timings.
need to put in different lines for each execution on the same field(*).
Closed Thread

Bookmarks

Tags
cron job, crontab, shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0