Hack Forums
[Ubuntu] SSH - Problem with Command Line - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Computing (https://hackforums.net/forumdisplay.php?fid=88)
+---- Forum: Linux (https://hackforums.net/forumdisplay.php?fid=85)
+---- Thread: [Ubuntu] SSH - Problem with Command Line (/showthread.php?tid=4509892)



SSH - Problem with Command Line - ♥Quantum♥ - Oct 27, 2014

Hey , got a little dumbass problem.. If I start my perl script via SSH , I can't do anything else without restart Putty and connect again to the Server. I read anywhere that I can close the perl script with a key like strg+ F10 or something , but at the moment I can't type any other command than the first .


* - Loki123 - Oct 27, 2014

nohup perl scipt.pl &

should put the script in background and keep it running after the SSH session is closed.


* - t224 - Oct 27, 2014

Maybe perl script didnt end so you cant do anything.
Try to open new ssh from putty - one more, so you can connect and killall to close it for example.
Maybe it will be helpful


* - Combatant - Oct 27, 2014

Do commands like ctrl+c or anything work? Try ctrl+z and see if that does anything or not.

Can you open a new instance of putty (right click, new session)?


* - GamingManiac - Oct 27, 2014

Install screen (Not sure on your distro)

Once installed run
Code
$ screen

Run your script
Code
$ ./script.pl

then to exit Press Ctrl + a then d

this will detach screen from the session, returning you to your original prompt. To reattach run
Code
$ screen -r



* - Syracusia - Oct 27, 2014

ctrl + c should cancel any operation.

If you want to keep a program running after closing putty use screen tutorial is above my post


* - Loki123 - Oct 27, 2014

(Oct 27, 2014 03:39 PM)GamingManiac Wrote:  Install screen (Not sure on your distro)

Once installed run
Code
$ screen

Run your script
Code
$ ./script.pl

then to exit Press Ctrl + a then d

this will detach screen from the session, returning you to your original prompt. To reattach run
Code
$ screen -r

Using screen for this purpose isn't the best way to do it. You can use pre installed tools such as, nohup, fg, bg instead.


* - GamingManiac - Oct 28, 2014

(Oct 27, 2014 04:10 PM)Loki123 Wrote:  Using screen for this purpose isn't the best way to do it. You can use pre installed tools such as, nohup, fg, bg instead.

You are probably correct - I forgot about nohup