Startup script sometimes fails - rc.local virtual machine

12,775

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

Example:

...
# By default this script does nothing.
sleep 10 
python <path-to-my-script> &
exit 0
Share:
12,775

Related videos on Youtube

Simon
Author by

Simon

Updated on September 18, 2022

Comments

  • Simon
    Simon over 1 year

    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?

  • Simon
    Simon over 11 years
    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.