Starting /home/kd/tinkering/test.py in fork_mode (1 instance) While pm2 was mainly built to run nodejs programs, it can handle others, such as python programs: $ pm2 start test.py Once the program begins, we can view the current status by running pm2 status: $ pm2 status Current process list is not synchronized with saved list. │ id │ name │ mode │ ↺ │ status │ cpu │ memory │ Starting /home/kd/tinkering/test.js in fork_mode (1 instance) Spawning PM2 daemon with pm2_home=/home/kd/.pm2 We can start a nodejs program with pm2 using pm2 start: $ pm2 start test.js As a result, we only get notified of the PID on our terminal initially and then only when the process has exited. In this case, we redirected the output and error streams to /dev/null, and the output we saw earlier is now suppressed. + Terminated gedit > /dev/null 2> /dev/null To avoid that, we can redirect the output to another location, say /dev/null: $ gedit 1>/dev/null 2>/dev/null & We also see that the output from the gedit command is still printed on this terminal. When we run the kill command on its PID, the program exits. Gedit is a GUI program, and it opens up on the desktop while leaving the terminal free to run other commands. (gedit:968967): GtkSourceView-WARNING **: 16:15:38.175: no color named 'white'įrom the above, we see that appending an ampersand to the gedit command sends it to the background and prints its PID, 968967. We can start a command in the background by appending “ &” to the end of the command: $ gedit &
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |