nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

print last execution date/time before execution

This is a discussion on print last execution date/time before execution within the Shell scripting forums, part of the Development/Scripting category; Hi, Is there any possibility that before i run my script it should print the last execution date/time?? Regards...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-30-2009, 07:34 PM
Senior Member
User
 
Join Date: Jul 2006
Posts: 138
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 4
asim.mcp is on a distinguished road
Default print last execution date/time before execution

Hi,


Is there any possibility that before i run my script it should print the last execution date/time??


Regards
Reply With Quote
  #2 (permalink)  
Old 11-30-2009, 09:42 PM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Posts: 525
Thanks: 54
Thanked 66 Times in 59 Posts
Rep Power: 8
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default

Hello,

You can try something like this at the top of your script.


PHP Code:
#!/bin/bash

# define the log location.
LOGFILE=/var/log/date_check_log

# execute date command when script is run.  This will continue to write the 
# date each time the script is run to the last line of the log file.
/bin/date >> $LOGFILE

# Then tail the log for the last line of the file when the script was run.

/bin/tail -n1 /var/log/date_check_log

# The above should print this output to stndout.  If you want to capture it in
# a file just define another log file and redirect output to it with >>. 
Not sure it this helps.

Jaysunn
__________________
Give a man a fish, feed him for today.
Teach a man to fish, he will feed himself from now on.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
command execution gr8linux Linux software 1 10-26-2009 08:41 PM
difference in GUI & CLI in command execution gr8linux Linux software 0 05-26-2009 09:58 PM
Automate command execution - reboot-command execution ganeshp@moris.org Shell scripting 2 12-03-2008 12:18 PM
Pause script execution untill each line is complete cosminnci Shell scripting 4 11-12-2008 07:49 PM
speeding up execution kavi Linux software 6 10-16-2005 05:31 PM


All times are GMT +5.5. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38