以下脚本在运行下一个命令之前需要一个系统
reboot
。
但是如果使用“
reboot
”命令重新启动,那么Ubuntu
将启动到“login
”屏幕,然后询问“username
”和“password
”然后你必须运行bash手动脚本again and again
.
是否可以在“
bash
”脚本中重新启动 Ubuntu 并继续 run
下一个命令 directly
?
这是一个有三个“重启”的例子:
#!/bin/bash
./test_1.sh
./test_2.sh
reboot
./test_3.sh
./test_4.sh
if [[ "$?" != "0" ]]
then
reboot
fi
./test_5.sh
if [[ "$?" != "1" ]]
then
reboot
fi
./test_6.sh
如何使用“
reboot
”或“kexec
”来实现这个功能?