我制作了一个菜单,其中第一个选项是启动,第二个选项是停止服务,第三个我想开发的是重新启动哪些服务将首先停止,然后有 20 秒的休息时间,然后服务将再次启动,现在请告知重新启动选项,我的代码是否正确。.我也想要一个停止手表,它将显示反向计数,如 1,然后是 2,然后是 3,然后在 20 上它会说启动服务
echo "Please enter the appropriate choice for doing the operations"
echo "
1) STOP Services
2) START Services
3 RestartServices Within 20 seconds
case $choice in
1)
echo "*************Stopping Services**************"
stopAll.sh
;;
2)
echo "*************Starting Services**************"
startAll.sh
;;
3)
echo "*************Restarting services within 20 Seconds*************"
stopAll.sh
sleep 20 seconds //please avise is this this correct way to sleep the services for 20 seconnds..??////
startAll.sh
;;
从睡眠手册页:
名字
sleep - delay for a specified amount of time
概要
sleep NUMBER[SUFFIX]... sleep OPTION
描述
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days. Unlike most implemen‐ tations that require NUMBER be an integer, here NUMBER may be an arbi‐ trary floating point number. Given two or more arguments, pause for the amount of time specified by the sum of their values.
您将需要使用sleep 20s
但s
是默认值,因此sleep 20
应该可以工作。