[英]Reboot few seconds later after program termination
I am maintaining ac/c++ program under linux, which will change BIOS settings and reboot to enable new settings. 我正在linux下维护ac / c ++程序,它将更改BIOS设置并重新启动以启用新设置。
Now test teams need to verify exit status, but the program will reboot right now after termination, so their script doesn't have enough time to record the status. 现在测试团队需要验证退出状态,但是该程序将在终止后立即重启,因此他们的脚本没有足够的时间来记录状态。
I have try system("shutdown -r -t 1")
, but it will wait for 1 minute.I just need few seconds delay time but shutdown
has no option for it. 我已经尝试了system("shutdown -r -t 1")
,但是它将等待1分钟。我只需要几秒钟的延迟时间,但是shutdown
无法选择。
Are there other methods( besides at or cron ) to implement a few seconds reboot delay time after program termination? 程序终止后是否还有其他方法( at或cron除外)来实现几秒钟的重启延迟时间?
You can try next line: 您可以尝试下一行:
system("nohup bash -c 'sleep 10; shutdown -r -t now' > /tmp/shutdown.log&");
This with return inmedialty your program and after 10 seconds will invoke the sutdown 这将间接返回您的程序,并在10秒后调用sutdown
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.