I'm trying to run a few scripts (MongoDB and Leanote) at startup but am running into a bit of difficulty. I have a file named leanote in:
/etc/init.d/leanote.sh
I also ran:
update-rc.d leanote.sh defaults 100
From what I understand this should run at the startup of the system, however I'm having problems where it doesn't appear to be running. Here is the file:
#!/bin/bash
su - keith -c mongod --dbpath /home/keith/data/ --logpath /home/keith/log/mongodb.log --logappend --fork &
su - keith -c sh /home/keith/leanote/bin/run.sh
No matter what I try, I can't seem to figure out why it's not running at startup. I'm able to check this by running mongo and it can't make a connection meaning that it doesn't appear to be running.
I tried following the guide here, and added the su portion as I thought it was running as root instead of my local user, although I'm not sure if that matters.
Any suggestions? Thanks!
sudo install scriptname.sh /path/to/script/scriptname
and then runscriptname
from anywhere to run that script. Not an answer but could help with getting them to run, or at least make it easier if they won't autostart.keith@leanote:/etc/init.d$ sudo install leanote.sh /home/keith/leanote/bin/run.sh
then got command not found when i tried runningleanote
..sh
on that to install the script. So:sudo install myscript.sh /path/to/script/mycommand
... notice there's no.sh
on there, so you'd just run that likemycommand
. But it might not be exactly what you need, not sure