I had an application that is dependent on another, starting up at the same time as the other application. One potential solution was to add a wait/sleep timer to the startup script but this would slow up booting or add unnecessary wait time when the application needed to be restarted without server reboot.
Change the boot sequence of the application that is dependent on the other, making it start up much later than the rest. This is well explained here.
Ubuntu still uses init scripts and that are symlinked to different runlevels. Therefore:
- Check the current boot sequence. This will give you a long list, you can filter it further to see the actual startup script you are looking for:
root@server:/home/user# ls /etc/rc*/
- Remove the current scripts:
root@server:/home/user# update-rc.d -f source remove Removing any system startup links for /etc/init.d/source ... /etc/rc0.d/K20source /etc/rc1.d/K20source /etc/rc2.d/S20source /etc/rc3.d/S20source /etc/rc4.d/S20source /etc/rc5.d/S20source /etc/rc6.d/K20source
- Add the new scripts with the new boot sequence. There is an example here. And a good explanation of how to specify with runlevels are here.
root@server:/home/user# update-rc.d source start 95 2 3 4 5 . stop 05 S 0 1 6 . Adding system startup for /etc/init.d/source ... /etc/rc0.d/K05source -> ../init.d/source /etc/rc1.d/K05source -> ../init.d/source /etc/rc6.d/K05source -> ../init.d/source /etc/rcS.d/K05source -> ../init.d/source /etc/rc2.d/S95source -> ../init.d/source /etc/rc3.d/S95source -> ../init.d/source /etc/rc4.d/S95source -> ../init.d/source /etc/rc5.d/S95source -> ../init.d/source
Finally restart your server and see if this was successful.