title: sqlite3 module cannot open database when started from ubuntu upstart
body: <p>Working in Ubuntu server 14.04</p>
  
  <p>I have an upstart .conf file in /etc/init for staring my node server. I am using forever. Here is what my script looks like</p>
  
  <pre><code>start on filesystem or runlevel [2345]
  expect fork
  setuid myUserId
  
  env HOME=/home/myUserId/
  env NODE_BIN_DIR=/usr/bin
  env NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
  
  script
  PATH=$NODE_BIN_DIR:$NODE_PATH:$PATH
  echo $PATH
  exec forever start -o /home/myUserId/nodeServ/lServer/logs/out.log /home/myUserId/nodeServ/lServer/server.js 1337
  end script
  </code></pre>
  
  <p>But I keep getting this error</p>
  
  <pre><code>Error: SQLITE_CANTOPEN: unable to open database file
  error: Forever detected script exited with code: 8
  </code></pre>
  
  <p>If I run the script from the command line exactly as it is in the conf file it works just fine. No problems. So I think it is a permissions issue. I have set permissions for read write execute on the database directory and the database and still I am unable to read from the file. </p>
  
  <p>I have tried so many different things and I cannot figure out why this is happneing</p>
  
  <p><strong>UPDATE:</strong> This problem appears to not be isolated to upstart. I tried staring forever in shell script as well and I get the same errors.</p>
  
  <p>I resolved my issue via workaround. Not using forever and starting node directly from the upstart file (allowing respawn). No issues. This appears to either be a sqlite3 issue or a forever issue.</p>