📜  无论如何都要保持服务正常 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:21.051000             🧑  作者: Mango

代码示例1
function finish {
    # re-start service
    sudo /etc/init.d/something start
}
trap finish EXIT
sudo /etc/init.d/something stop
# Do the work...

# Allow the script to end and the trapped finish function to start the
# daemon back up.