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
expiry date for files? RRVARMA UNIX for Advanced & Expert Users 3 09-01-2009 10:18 AM
Disable the password expiry date kingganesh04 SuSE 1 05-13-2009 12:53 AM
Find user password expiry date oztoma UNIX for Dummies Questions & Answers 4 04-17-2009 10:07 AM
Digital Certificate Expiry Date RG18173 UNIX for Advanced & Expert Users 1 02-06-2009 03:00 AM
domain expiry date learnbash Shell Programming and Scripting 6 05-22-2008 03:43 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 1 Week Ago
learnbash learnbash is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 96
Expiry date of shell script

Hello folks,

I have question about my expiry of shell script, today date is 2009-11-11, i will have to deploy a script today, how i should setup that my script will not work after 2010-05-11, Between if someone will change the date of server then script will again not work, please give suggestions and recommendation. I need to add this expiry part in shell script.
  #2 (permalink)  
Old 1 Week Ago
rdcwayx rdcwayx is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 190
timestamp will help you. If you have gnu date or your date command support %s , can use below code:

Code:
date -d "2010-05-11" +%s
1273500000
After you get the timestamp, write a if-then-fi to compare the script running date with it.
  #3 (permalink)  
Old 1 Week Ago
learnbash learnbash is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 96
Quote:
Originally Posted by rdcwayx View Post
timestamp will help you. If you have gnu date or your date command support %s , can use below code:

Code:
date -d "2010-05-11" +%s
1273500000
After you get the timestamp, write a if-then-fi to compare the script running date with it.
Thanks for your kind reply, i have done it.
  #4 (permalink)  
Old 1 Week Ago
jgt jgt is offline
Registered User
  
 

Join Date: Apr 2007
Location: 44.21.48N 80.50.15W
Posts: 439
This does not prevent the script from being run by back dating the system date. You will also need to add a data file that keeps track of the current date and sets a flag when 2010-05-11 occurs so that the script will never run again no matter what the date, or get the current date from a place other than the system that you are running the script on.
Sponsored Links
Reply

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 11:11 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