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...


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 30-11-2009, 06:34 PM
Senior Member
User
 
Join Date: Jul 2006
Posts: 145
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 30-11-2009, 08:42 PM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Posts: 600
Thanks: 61
Thanked 78 Times in 70 Posts
Rep Power: 10
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 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
__________________
Have a look at what I have been working on
http://www.shellasaurus.com
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 26-10-2009 07:41 PM
difference in GUI & CLI in command execution gr8linux Linux software 0 26-05-2009 08:58 PM
Automate command execution - reboot-command execution ganeshp@moris.org Shell scripting 2 03-12-2008 11:18 AM
Pause script execution untill each line is complete cosminnci Shell scripting 4 12-11-2008 06:49 PM
speeding up execution kavi Linux software 6 16-10-2005 04:31 PM


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


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 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