Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: For loop to execute command in all VPS  (Read 2603 times)

0 Members and 1 Guest are viewing this topic.

Jithin

  • Guest
For loop to execute command in all VPS
« 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.