linux - What's wrong with my rc.local file (Ubuntu)? -
i have python daemon process gets started via rc.local. same script, same permissions, installed on few other ubuntu boxes have. runs without trouble on installations. is, after restarting box, daemon process running.
with particular installation though, daemon process not running time log in , check existence of process. rc.local files between systems identical (or @ least close enough):
localaccount@sosms:~$ cat /etc/rc.local #!/bin/sh -e # # rc.local # # script executed @ end of each multiuser runlevel. # make sure script "exit 0" on success or other # value on error. # # in order enable or disable script change execution # bits. # # default script nothing. python /var/www/mydaemon/main.py > /var/log/somelog.txt exit 0 the permissions are:
localaccount@sosms:~$ ls -la /etc/rc.local -rwxr-xr-x 1 localaccount localaccount 370 jun 3 11:04 rc.local i tested if rc.local process getting executed using test rc.local:
localaccount@sosms:/var/log/sosmsd$ cat /etc/rc.local #!/bin/sh -e # # rc.local # # script executed @ end of each multiuser runlevel. # make sure script "exit 0" on success or other # value on error. # # in order enable or disable script change execution # bits. # # default script nothing. echo "test" > /home/localaccount/test1 /usr/bin/python /var/www/sosms/sosmsd/main.py > /var/log/sosmsd/log/log echo "test" > /home/localaccount/test2 exit 0 localaccount@sosms:/var/log/sosmsd$ and first test file (test1) gets created after restarting box. i'm guessing means python line causing kind of issue, no output in /var/log/sosmsd/log/log:
localaccount@sosms:~$ ls test1 update:
i followed larsks' advice , determined getting error launching python script:
mysql_exceptions.operationalerror: (2002, "can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2)") does mean rc.local being executed before mysql has had chance initialized? go here?
you should create init script /etc/init.d/mydaemon daemon available skeleton.
then able set startup order mysql available.
here good starting point.
Comments
Post a Comment