2013-09-22 20 views
-1

我做了一個菜單,其中第一個選項是啓動,第二個是停止服務,第三個我想開發的是重新啓動,其中服務 將停止第一,然後一個20秒的休息時間將是theres,然後服務將重新開始,現在請告知重新啓動選項,我有代碼是否正確.. 我想要一個停止手錶也顯示反向計數像1,然後2,然後3,然後在20它會說啓動服務睡在shell腳本之間的一個過程

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 

     ;; 
+0

我認爲它shldbe'睡眠20s' – Lokesh

+3

你甚至不打擾在谷歌上搜索你的疑惑,你只是在這個網站發射的疑惑:http://stackoverflow.com/questions/18941842/script-not-閱讀3和4選項,http://stackoverflow.com/questions/18941409/getting-error-in-the-below-script和另一個問題已被刪除。此外,你不接受任何答案。我認爲你應該在嘗試解決問題或者在問問題之前自己尋找解決方案。 –

回答

1

從睡眠手冊頁:

NAME

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 20ss是默認設置,以便sleep 20應該工作。

+0

非常感謝。!它的工作原理。 –

相關問題