Commonly, processes run in terminal will be terminated when logging out of terminal. There are multiple ways to keep them running after closing terminal.
1) forever
https://www.npmjs.com/package/forever
2) pm2
https://pm2.keymetrics.io/docs/usage/quick-start/
3) nohup
Regular command: mycmd --arg value
Nohup command: nohup mycmd --arg value
4) setsid
Create mycmd.sh as:
#!/bin/bash
mycmd --arg value
Run:
setsid ./mycmd.sh
5) daemonize
Similar to setsid, create a shell file to run mycmd.
6) disown
Raw and powerful to separate command from terminal.
mycmd --arg value & disown $!
No comments:
Post a Comment