2

I have an Intel NUC running 3.13.11.6; and I have written an application that runs some simple data polling (cpu, memory usage, disk usage etc ...). The NUC is headless, so I connect via SSH (putty) and can execute the program.

My issue is that I need the program to run for days; and if I close the putty session, the process is killed.

I do not have cron on the system, or some way to remote execute the application (that I am aware of).

*** edit - some recommendations for using screen and tmux were great, however I am learning this is a custom implementation of Ubuntu and these are not available.

Does anyone have any suggestions on the best way to run an application on a headless Ubuntu system and not have the process killed when the ssh session disconnects?

Appreciate any help!

Thank you,

Dan.

0

2 Answers 2

1

Try using nohup:

$ nohup ./example.sh &

This will run your process in the background and won't be terminated when you exit your shell (logout). It will write output to a file called nohup.out.

1
  • This resolves the issue. As this is a light install of Ubuntu, many of the tools normally available were not. I was not aware of nohup. Thanks!
    – Dan G
    Apr 7, 2015 at 12:48
1
screen ./example.sh

will start your process inside an own shell. You can detach from this shell by holding CTRL and pressing A+D.

Now you can close your SSH connection and the process will keep running. You can also reconnect via SSH and run

screen -r

to get back to your process

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