Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I modified /etc/rc.local on my Amazon AWS AMI

#!/bin/sh
touch /var/lock/subsys/local
# setup hostname properly
/usr/bin/python /root/automation/initSystem.py

so last line calls Python script that does configuration (Env variables, hostname, networking settings etc) and then does /etc/init.d/network restart

if I run rc.local manually /etc/rc.local everything is just fine

when system auto starts it doesn't work. So touch command (2nd line - worked), but python script is never executed, at least results of it's execution (setting up a hostname and restarting network interface seems doesn't work at all)

Any ideas?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

We can't debug a mystery script. Does running the python script work with an empty environment? Try:

env -i /usr/bin/python /root/automation/initSystem.py

Modify your script to capture the output of your command in the script:

/usr/bin/python /root/automation/initSystem.py > /root/init.stdout 2> /root/init.stderr

and it'll probably contain hints as to why it failed.

share|improve this answer
    
found the error with env -i :) thanks a LOT –  DmitrySemenov Dec 14 '13 at 1:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.