Help to check uptime post 30 min or so after every reboot


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help to check uptime post 30 min or so after every reboot
# 1  
Old 05-13-2014
RedHat Help to check uptime post 30 min or so after every reboot

Hi,

Please help me to cross verify the post reboot time.
I want to execute some script after every reboot, which will happen only post 20-30 mins of reboot.
If uptime is >24hrs, script should not execute.

I tried with below command, but seems no luck.
>>
uptime | sed 's/^.*up//' | awk -F, '{ if ( $3 ~ /user/ ) { print $1 $2 } else { print $1 }}' | sed -e 's-/-:-/-\- hours\

/' -e 's/ min//' -e 's/$/\ minutes/' | sed 's/^ *//'
>>
It works fine if uptime < 24 hrs. But what, if system is up for days?

Please help..!!!
# 2  
Old 05-13-2014
Put a line with @reboot into your crontab, and start the script to be executed with e.g. sleep 1800 to wait 30 min.
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to check last unexpected reboot time Solaris 10?

Dear all can you give me command to show me last unexpected reboot time the date, month, and the year on solaris 10 i've tried uptime who-b last reboot but nothing give me the year last reboot only the date , month and time (6 Replies)
Discussion started by: gema.utama
6 Replies

2. Shell Programming and Scripting

How to check the status of script for every 5 min?

Hi, Can any1 provide the code for my req: I am loading few set of files into database through one unix script. I ll try to describe the process: load_cdr-->main script Source Feeds are A & B. File in A-akm.dat File in B-bkm.dat Now my script runs through cron jobs everyday...and for both... (6 Replies)
Discussion started by: gnnsprapa
6 Replies

3. AIX

Post mortem for critical Production AIX System Reboot/Crash

Hello All, Critical AIX production box crashed/rebooted while our team is working on it and we need to generate a detailed report for that, below are few questions that need to be included in the report. (We are System Administration team and everyone in our team has root access via sudo as well... (3 Replies)
Discussion started by: lovesaikrishna
3 Replies

4. Shell Programming and Scripting

Extract the uptime from the output of the uptime command

Hi! I want to extract the uptime from the output of the uptime command. The output: 11:53 up 3:02, 2 users, load averages: 0,32 0,34 0,43 I just need the "3:02" part. How can I do this? Dirk (6 Replies)
Discussion started by: Dirk Einecke
6 Replies

5. Solaris

uptime and last reboot command in solaris

Hi, Can someone explain in detail what 'uptime' ,'last reboot' and 'who -b' commands do in solaris. this commands are not executing in every solaris box. why this is happening. Has solaris got some inbuilt commands into it. If yes then where i have found them? Thanks,Soubhik (6 Replies)
Discussion started by: soubmukh
6 Replies

6. UNIX for Dummies Questions & Answers

SFTP script - poll every min to check file complete before transfering

Hello, Before I do a GET remote file, I need to ensure the remote file is a complete file i.e. whatever process is saving the file to the remote folder should complete the transfer before I go GET it through my script. So I'm thinking I need to poll the remote file every minute or so to... (4 Replies)
Discussion started by: srineel
4 Replies

7. SuSE

How to check Server reboot reason

Hi, I want to know how can we check Server reboot reason on Suse linux ? or what caused server to reboot or hung. anyone knows abut the it. ? Bryan (3 Replies)
Discussion started by: bryanabhay
3 Replies

8. Shell Programming and Scripting

To check the lists of file created between 30-60 min

Hi I have to write a script, that will find out the lists of files in a particular directory, which are created between 30-60 min intervals. (3 Replies)
Discussion started by: velocitnitin
3 Replies

9. AIX

How to check who/which id perform a system reboot?

Hi Guys, I would like to know is there a way to find out who or which id performed the system reboot?Uptime only shows the last date the system was reboot but no userid or ip add.Need to investigate something due to some reboot issues. Thanks Giri (1 Reply)
Discussion started by: giriplug
1 Replies

10. Solaris

different between soft reboot and hard reboot

Hi Guru's Can any want here could explain to me the different between soft reboot and hard reboot . Best Regards Seelan (3 Replies)
Discussion started by: seelan3
3 Replies
Login or Register to Ask a Question