Hi, Is there any way to run .sh script from ssh and in case if I loose connection script will still be working until finish ? Thank You
Yes. The easiest way would be to use the Linux program called 'screen' (assuming it's installed). You start a screen session, run the command, and then detach the screen session. The commands you entered while in the screen session will continue to run. When you log back into SSH, you can simply re-attach that screen session. You could also use commands like nohup but that's more technical to understand.
Right, you can use screen to execute such commands. To install screen # yum install screen to start the screen session # screen execute your command there and detach the screen session, press Ctrl+a+d to re-attach to screen, use # screen -r Another method, is to execute the command in the background by adding '&' ampersand at the end # sh filename.sh &
if you add ampersand and close connection process will end as well. I used cron to run scripts while I am offline, but I may try "screen" as well. Thanks.