Step 1. Create an Upstart script.


Upstart scripts live in /etc/init by default, and that's also the place they live on your Synology NAS. You name the script 'servicename.conf', where 'servicename' is whatever you want it to be called. I called mine 'foobar' because I'm inventive like that, so the file is /etc/init/foobar.conf.


# only start this service after the httpd user process has started start on started httpd-user # stop the service gracefully if the runlevel changes to 'reboot' stop on runlevel [06] # run the scripts as the 'http' user. Running as root (the default) is a bad idea. setuid http # exec the process. Use fully formed path names so that there is no reliance on $PATH # the 'www' file is a node.js script which starts the foobar application. exec /usr/bin/node /volume2/code/foobar/bin/www

Step 2. Start the service manually

The best part about keeping it simple is that you are more likely to get it running. If there is an error in your script, it won't start and it won't tell you why. It will just say the service could not be found.

To start the script, just type start foobar from the terminal. If it's happy, you'll see the process start and the PID displayed on the console. To stop it again, type 'stop foobar'.

Step 3. Check the script will auto-start

If you pass step 2 OK, then this is just a formality. The script will start when you restart your box. When ready type 'shutdown -r now' and allow your NAS to reboot. When it comes up again, you will be able to see that your service is running by hitting the URL, or by checking the logs which, by default, go to /var/log/upstart - all sysout from your process will go here.


Article found here:

jackpot city casino
Thursday the 22nd - Full Page copyright - Design by