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

Put a line with @reboot into your crontab, and start the script to be executed with e.g. sleep 1800 to wait 30 min.

1 Like