I tried to use vmrunprograminguest command to change the ip address of a virtual machine.and I write a shell to perform it, as followed
sed -i "s/IPADDR.*/IPADDR=123.123.234.1/g" /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i "s/PREFIX.*//g" /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i "s/NETMASK.*/NETMASK=255.255.0.0 /g" /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/init.d/network restart
and i also tried vmrun,like vmrun -gu root -gp 123456 runProgramInGuest "E:\\redhat\\Red Hat Enterprise Linux 6.vmx" /bin/bash /root/ipchange.sh
the problem is that the first four line is executed perfectly well, but the network cannot restart. and no error code is returned.
similar problem occured when i try to run other command like start arpd as a background service.
looking forward to your help.