📅  最后修改于: 2022-03-11 14:50:21.051000             🧑  作者: Mango
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.