Ja potrebujem robit update na X-terminaloch v ucebni, ktora nesmie mat svoje DHCP ale az DHCP Ustavu. DHCP ustavu nemam k dispozicii. A na update staci skriptik a jedine, co mi gsh da je mozno paralelizmus v ramci umyslene urobenych troch faz.
skript
#!/bin/bash
IPCKY=$(netstat -a|egrep x11|sort -u -k5|awk '{print $5}' |sed 's/:x11-2//')
PRIKAZ="yes yes |apt-get update"
for IP in $IPCKY;
do
echo "refresh repositories of:" $IP
ssh -i ./my-id_rsa root@$IP $PRIKAZ;
done
PRIKAZ="yes yes|apt-get upgrade"
for IP in $IPCKY;
do
echo "update of:" $IP
ssh -i ./my-id_rsa root@$IP $PRIKAZ;
done
PRIKAZ="reboot"
for IP in $IPCKY;
do
echo "reboot of:" $IP
ssh -i ./my-id_rsa root@$IP $PRIKAZ;
done
zeby to bolo az tak tazke si nemyslim
man 1p wiat
"
sleep 1000&
pid=$!
kill −kill $pid
wait $pid
"
#!/bin/bash
for i in `seq 0 9`; do
doCalculations $i &
done
wait
The above script will wait for all 10 spawned subprocesses, but it will always give exit status 0
wait also (optionally) takes the PID of the process to wait for, and with $! you get the PID of the last command launched in background. Modify the loop to store the PID of each spawned sub-process into an array, and then loop again waiting on each PID.
A na toto mame += v cykle
Takze ono to tak zlozite nie je. Samozrejem IPC v shellio asi nebude, neskumal som