Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've added simple line:

python <path-to-my-script> &

to /etc/rc.local, but I've noticed that after migration from one host to the other one, the script sometimes fails.

I'm using KVM, VM's are under Ubuntu 12.04 32-bits. Host's have Ubuntu 12.04 64-bits and I'm using Live Migration (private cloud built with Openstack).

I don't know it's KVM/Libvirt's fault or maybe I'm doing something wrong on Ubuntu or maybe it's cloud software's fault?

Could it be rc.local fault? Is there something what I should to know, when I'm using rc.local and it may be a cause of this behaviour?

share|improve this question

Try adding a 10 second pause before the script command. Sometimes rc.local runs too soon....


# By default this script does nothing.
sleep 10 
python <path-to-my-script> &
exit 0
share|improve this answer

You should first check if isn't your program that is crashing. The easiest way to do that is to redirect its output to a file and inspect it later (feel free to replace /myprogram.log to something else):

python <path-to-my-script> &>/myprogram.log &

Also, check that rc.local has the following line at the end

exit 0

and it is executable. You can check that using ls -la /etc/rc.local. It should display something like this:

ls -la /etc/rc.local
-rwxr-xr-x 1 root root 629 Aug 10 19:41 /etc/rc.local

If that's not the case you can make it executable issuing sudo chmod +x /etc/rc.local.

share|improve this answer
Nah it's not the case. I've already checked everything you wrote :) Also I don't have errors on standard output and diagnostic output. It looks like python is just exiting and I don't know why. I created simple while-loop with threads where I'm generating 100% cpu usage and it doesn't work sometimes after migration. Only after migration and sometimes not every time. I'll check migration documentation. Maybe hypervisor is re-running services after migration and because it's only in rc.local it doesn't start properly. – Simon Oct 10 '12 at 18:46

Your Answer


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.