I'm porting some SysV-style service scripts for HBase (a java service) to upstart.

The sysv scripts don't call java directly, but instead call hbase-daemon.sh. This is a start-stop-daemon-like tool that ships with the package which pulls in a lot of configuration and ultimately ends in a nohup java ... & to actually run the process as a daemon.

Since the configuration logic in hbase-daemon.sh is involved, I would rather not modify or rewrite it (to remove the nohup) and instead have upstart call it directly.

This seems to be what the expect clause is for, except in my case it isn't working. Even with expect daemon (the two fork case), I end up tracking the wrong pid on service start. This suggests that my scenario is forking too much, or perhaps nohup shouldn't be handled with expect, or yet something else.

How can I use upstart to manage a service that expects to be started with a script that calls nohup?

  • can you post script source? what if the system user executes it instead? – j0h Aug 16 '15 at 10:57
  • no experience with this myself, but this answer seems rather ok-ish? Could you provide the upstart .conf if that exec part doesn't work? I could easily try and reproduce with a dummy-script running a nohup sleep 500? :-) – Anakin Aug 19 '15 at 15:37

You could try using crontab, and enter this in the terminal:

 crontab -f nohup

and then enter this:

 pyton(version) -v -f echo 'nohup' & disown

and then enter this in the terminal:

 crontab reboot

and it might work fine this way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.