I've seen people saying use screen.
But when I typed "screen" in the terminal, I got: "Please set a terminal type."
Any idea how I can fix this?
I've seen people saying use screen.
But when I typed "screen" in the terminal, I got: "Please set a terminal type."
Any idea how I can fix this?
To answer your initial question, the most basic way to keep a command running after logging out is to run it with the nohup command.
For example, if I wanted to run a script, and drop it into the background while keeping it running after logging out I would type:
nohup ./myscript &
More information can be found here: https://en.wikipedia.org/wiki/Nohup
Otherwise, as you stated, screen is a good option.
SOLUTION 1 :
If you want to run screen , these are the way :
Login to your user :
-- To create a new session for screen
screen -S screenname
-- To detach from the screen
Ctl + ad
-- To reconnect to screen :
screen -dr screenname
-- To check the current open screens :
screen -ls
-- While in screen , you can use
Ctl + ac (to create new screenwindows)
Ctl + an (move to next screenwindow)
Ctl + ap (move to previous screenwindow)
SOLUTION 2 :
You can run a script like this :
/fullpath/to/script/scriptname.sh >> /fullpath/to/log/logname.log 2>&1
Ctl + z
bg %1 (run in background)
disown %1
-- To check if its running :
ps -ef | grep scriptname.sh
Note : Ctl here means control key