Note that there are some explanatory texts on larger screens.

plurals
  1. POHow does one create a script to execute multiple "exec" commands sequentially?
    text
    copied!<p>I am very new to Linux Shell Scripting and was wondering if anyone could help me with the following.</p> <p>I created a script to synch time with my linux machine but only one exec command seems to complete</p> <pre><code>#!/bin/bash #Director SMS Synch Time Script echo The current date and time is: date echo echo Synching GTS Cluster 1 directors with SMS. echo echo Changing date and time for director-1-1-A exec ssh root@128.221.252.35 "ntpd -q -g" echo Finished synching director-1-1-A echo sleep 2 echo Changing date and time for director-1-1-B exec ssh root@128.221.252.36 "ntp -q -g" echo Finished synching director-1-1-B echo sleep 2 echo Finished Synching GTS Cluster 1 directors with SMS. sleep 2 echo echo Synching SVT Cluster 2 directors with SMS. echo echo Changing date and time for director-2-1-A exec ssh root@128.221.252.67 "ntpd -q -g" echo Finished synching director-2-1-A echo sleep 2 echo Changing date and time for director-2-1-B exec ssh root@128.221.252.68 "ntpd -q -g" echo Finished synching director-2-1-B echo sleep 2 echo Changing date and time for director-2-2-A exec ssh root@128.221.252.69 "ntpd -q -g" echo Finished synching director-2-2-A echo sleep 2 echo Changing date and time for director-2-2-B exec ssh root@128.221.252.70 "ntpd -q -g" echo Finished synching director-2-2-B sleep 2 echo echo echo Finished Synching SVT Cluster 2 directors with SMS. </code></pre> <p>The script only seems to complete after the first exec command.</p> <p>Thu Aug 25 12:40:44 EDT 2011</p> <p>Synching GTS Cluster 1 directors with SMS.</p> <p>Changing date and time for director-1-1-A</p> <p>Any help would be greatly appreciated =)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload