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.

timestamp will help you. If you have gnu date or your date command support %s , can use below 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.

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.