Admin-Ahead Community

Linux => Virtualization => Topic started by: Jithin on November 01, 2013, 06:26:50 pm

Title: For loop to execute command in all VPS
Post by: Jithin on November 01, 2013, 06:26:50 pm
Hi Guys,

If you want to execute some commands under all VPS's under a Virtuzzo or OpenVZ node, you can use the simple for loop script given below.

for CT in $(vzlist -o ctid);do
echo "== CT $CT ==";
vzctl exec $CT <command here>;
done

Give it a try.