Sorry for the newb question but I'm not a strong scripter by any means. I have a simple bash script that i created that runs perfectly fine when executed manually. Also if i run "/etc/rc.local" manually it will execute the script fully! My problem is that rc.local from boot will not execute the entire script and im having troubles determining why.
Here's the script:
#!/bin/bash # Retrieve instance ID from metadata GET http://169.254.169.254/latest/meta-data/local-ipv4 > /metadata # Replace Hostname in zabbix.conf with instance ID from metadata sudo sed -i "s/td1wb-b01/$(cat metadata)/g" /etc/zabbix/zabbix_agentd.conf # Replace Hostname with instance ID from metadata sudo hostname $(cat metadata) sudo sed -i "s/web2/$(cat metadata)/g" /etc/sysconfig/network # Restart the zabbix agent to register sudo service zabbix-agent restart exit 0
It seems to start running since I DO see the /metadata file appear. After that first line though, nothing else is executing. Any help is greatly appreciated!!