[racktables-users] Re: Mass object creation

On 09/01/11 14:20, Robert Parten wrote:
I have about 200 objects of the same type to create so I am wondering if there is any way to do this as a "one liner" script that creates objects "server" with names server{001-150}

You can try following shell script to create a SQL batch file you can later import to your Rackables database.


for ((i=1;i<=150;i++))
do
printf "INSERT INTO RackObject (name, objtype_id) SELECT '%03d', 4 \n" $i
done


Cheers,
Wawrzek
--

Wawrzyniec (Wawrzek) Niewodniczański - 01223 435603 (35603) - wawrzekn
System Administrator - Engineering Services Team (XenServer)
Citrix Systems, Building 101, Cambridge Science Park, CB4 0FY, Cambridge
PhD in Quantum Chemistry, MSc in Molecular Engineering


Other related posts: