Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's wrong with my rc.local file (Ubuntu)?
    primarykey
    data
    text
    <p>I have a python daemon process that gets started via rc.local. This same script, with the same permissions, is installed on a few other Ubuntu boxes I have. It runs without trouble on those installations. That is, after restarting the box, the daemon process is running.</p> <p>With this particular installation though, the daemon process is not running by the time I log in and check for the existence of the process. The rc.local files between systems are identical (or at least close enough):</p> <pre><code>localaccount@sosms:~$ cat /etc/rc.local #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. python /var/www/myDaemon/Main.py &gt; /var/log/somelog.txt exit 0 </code></pre> <p>The permissions are:</p> <pre><code>localaccount@sosms:~$ ls -la /etc/rc.local -rwxr-xr-x 1 localaccount localaccount 370 Jun 3 11:04 rc.local </code></pre> <p>I tested if the rc.local process is getting executed by using this test rc.local:</p> <pre><code>localaccount@sosms:/var/log/sosmsd$ cat /etc/rc.local #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. echo "test" &gt; /home/localaccount/test1 /usr/bin/python /var/www/sosms/sosmsd/Main.py &gt; /var/log/sosmsd/log/log echo "test" &gt; /home/localaccount/test2 exit 0 localaccount@sosms:/var/log/sosmsd$ </code></pre> <p>And only the first test file (test1) gets created after restarting the box. I'm guessing it means that the python line is causing some kind of issue, but I get no output in /var/log/sosmsd/log/log:</p> <pre><code>localaccount@sosms:~$ ls test1 </code></pre> <p><strong>Update:</strong></p> <p>I then followed larsks' advice and determined that I was getting this error from launching the python script:</p> <pre><code>mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)") </code></pre> <p>Does this mean that rc.local is being executed before MySQL has had a chance to be initialized? Where do I go from here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload