3

I want to run a nodeJS web server on a couple of machines which I don't have sudo access on. What would be a good way to do this?

The two requirements are:

  1. running the service without being logged in (obviously)
  2. automatically restarting if the machine is rebooted.

For 1., I've typically used nohup but is this a reasonable approach for production instances?

For 2., I can (hackily) add a crontab that starts the service, which will simply fail if it's already running. Is there a better way?

These servers are RHEL, but I'd prefer solutions that would also work for Ubuntu, if possible.

1

1 Answer 1

3

You could use @reboot as the crontab startup field to make relatively sure it hasn't already been started.

3
  • So reading between the lines, using crontab is not a bad way to run a service like this? Jun 12, 2013 at 8:40
  • @SteveBennett Some would say that a non-admin running a service is "bad". But inasmuch as doing so isn't bad in your case, cron isn't a bad way to run it.
    – depquid
    Jun 12, 2013 at 20:05
  • 1
    An admin running a service is much worse. If you have any cron jobs starting services as root, I hope you demote them to nobody or some other user...
    – l0b0
    Jun 12, 2013 at 20:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .