I need to find the last system shutdown time. I got a command last that is used for this.But the command is not give the year. Below i posted the sample output
year field is important for me. how can i get that?
Guide me.
Moderator's Comments:
Please use code tags for listings and console output.
If you just need last shutdown; try using the command:
you can do some calculation with curent date-time to get the exact shutdown date.
Note: There might be few hours difference; as shutdown time and uptime would not be same; this difference of hours would be system downtime.
This may result in date change also, if shutdown occured around midnight or system downtime was fairly large.
Hope this helps.
Last edited by freakygs; 01-11-2011 at 07:03 AM..
Reason: spell error
Have a look at the "fwtmp" command. This can be used to read the file which "last" uses and outputs the history in text format - including the full date.
You are correct, maruthu:
Gives you the time of the last shutdown.
But:
Shows the time of the last (re)boot, which corresponds to what is shown by uptime:
You can use awk, sed, perl, and numerous other tools to extract and format the date and time of the last reboot to your liking. Please note that the year is not displayed.
You can parse /var/log/wtmp to get what you need. For instance, using the examples in Formatting and Printing Wtmp as a starting point:
will give you the time of the reboot:
Dear all,
I am kindly seeking assistance on the following issue.
I am working with data that is sampled every 0.05 hours (that is 3 minutes intervals) here is a sample data from the file
5.00000 15.5030
5.05000 15.6680
5.10000 16.0100
5.15000 16.3450
5.20000 16.7120
5.25000... (4 Replies)
Hey everyone. Upon studying linux trying to learn it inside and out, I'm reading about the issue of time. Hardware clock time vs the more commonly referenced System Time. What causes the two to grow apart, and what causes the time itself to stray away from UTC? at present my clock is a second and... (1 Reply)
Hi All,
Is there any command to add additional time to date command. I need to add 5 hours to the present system time. I am getting the time by using date command.
WORKFLOW_START_TIME=`date +%m/%d/%Y\ %H:%M:%S`
Thanks (8 Replies)
Hi ,
I am trying to :wall: my head while scripting ..I am really new to this stuff , never did it before :( .
how to find cpu's system high time and user time high in a script??
thanks , help would be appreciated !
:) (9 Replies)
On Solaris 10 server the system date won't match with the timestamp on files created by a cron jobs, Please help
here is what i get when i check for system date
infodba-ie10ux014:/tcpdv1_ie10/tcadmin/bin\n\r-> date
Tue Apr 24 15:27:43 GMT 2012at same time i executed a cron job, and checked... (4 Replies)
Dear All,
OS = Solaris 5.10
Hardware Sun Fire T2000 with 1 Ghz quode core
We have oracle application 11i with 10g database. When ever i am trying to take cold backup of database with 55GB size its taking long time to finish. As the application is down nobody is using the server at all... (8 Replies)
Hello All -
I have a script that grabs data from the net and outputs the following data
46029 46.144 -124.510 2010 07 26 22 50 320 4.0 6.0 2.2 9 6.8 311 1012.1 -0.9 13.3 13.5 13.3 - -
46041 47.353 -124.731 2010 07 26 22 50 250 2.0 3.0 1.6 8 6.4 - 1011.6 - ... (0 Replies)
i am using function
gethrtime() in sun solaries
to get the time independent of the system time.Problem with this function is if we restart the system time will change to '0'.is there any other way to resolve this problem.
thanks & regards
suresh (3 Replies)
I have a requirement of checking the current system time and performing certain actions in a shell script. example:
if the current system time is greater than 1400 hrs, then perform step 1,2,3
if the current system time is greater than 1000 hrs, then perform step 1,2
if the current system time... (2 Replies)
I need to know how to turn off the beep in my unix environment. I tried with the Common Desktop Environment on solaris but it didn't work. I used to know the environment variable to set but I have forgotten it. (1 Reply)