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
How to find a date which is 7 days past when given current date ladtony Shell Programming and Scripting 17 04-09-2009 04:06 PM
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 9 12-01-2008 11:37 PM
Perl: Extracting date from file name and comparing with current date MKNENI Shell Programming and Scripting 4 03-26-2008 04:01 PM
date issue-find prevoius date in a patricular format bsandeep_80 UNIX for Advanced & Expert Users 3 11-15-2007 08:42 PM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 07:15 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-17-2009
RubinPat RubinPat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 75
date

Can hhhh

Last edited by RubinPat; 03-17-2009 at 04:54 PM..
  #2 (permalink)  
Old 03-17-2009
curleb curleb is offline
Registered User
  
 

Join Date: Mar 2008
Location: Here, in my Ivory Tower...
Posts: 68
It might vary by the system's version of date, but something like the following might work:

Code:
export my_date=$(date +'%w') 

if [[ $my_date = '0' ]] || [[ $my_date = '6' ]] 
then
...
fi
or

Code:
export my_date=$(date +'%u') 

if [[ $my_date = '6' ]] || [[ $my_date = '7' ]] 
then
...
fi
Note, that the above varies by ksh93's version of date. But you'd really only want this to run once a day, no? What is there to block the job if it's already running/been run that day...?
  #3 (permalink)  
Old 03-17-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,310
Code:
eval "$( date "day=+%w time=%H%M" )"
if [ $day$time = 52000 ] || [ $day -eq 6 ] || [ $day == 0 ]
then
  your_command
fi
  #4 (permalink)  
Old 03-17-2009
RubinPat RubinPat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 75
curleb,

How do I get to run for Friday 8:00 PM onwards. Plz help
  #5 (permalink)  
Old 03-17-2009
RubinPat RubinPat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 75
Hi cfajohnson,

If u dont mind can u plz explain the command and how do i execute it?
  #6 (permalink)  
Old 03-17-2009
RubinPat RubinPat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 75
Thanks Curelb and cfajohnson.

I got Curleb things to work. but cfa ur code doesnot work.

Last edited by RubinPat; 03-19-2009 at 03:45 PM..
Sponsored Links
Closed Thread

Bookmarks

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 06:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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