Problem is it does not enter into sub SHUTDOWN when computer shutdown happens. Could you please help me with this.use strict; my($startupTime) = time; # Setup system signal handlers $SIG{'TERM'} = 'SHUTDOWN'; $SIG{'INT'} = 'SHUTDOWN'; while(1) { sleep(10); } # Signal handler for SIGTERM sub SHUTDOWN { my($shutdownTime) = time; my($duration) = $shutdownTime-$startupTime; # Write out the shutdown time open(OUT, ">>$filename"); # Note: $$ is the process id for this script print OUT formatTime($shutdownTime)." Shutdown Uptime: ".formatDu +ration($duration)."\n"; close OUT; exit(1); }
In reply to Uptime daemon by zerberra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |