I'm new to setting processes running via ssh on a server. To allow me to step away and return to them I'm trying to run them in a screen session.
# ssh onto server
ssh myid@server.co.uk
# Start screen session
screen -S myscreen
# Set the process running.
gatk CombineGVCFs \
-R "/refs/hg38/gatk download/Homo_sapiens_assembly38.fasta" \
--variant "/data/MSH3repeat_S1_L001_g.vcf.gz" \
--variant "/data/20201028_CCDG_14151_B01_GRM_WGS_2020-08-05_chr5.recalibrated_variants.vcf.gz" \
-O "/data/cohort.g.vcf.gz"
When I check the screens that are running immediately with screen -ls
then I can see myscreen
. However, when I switch off the computer and then return the next day I run screen -ls
and it says no sockets.
I think it might be something to do with the fact when I set up a new screen with e.g. screen -S myscreen
I always get this error:
File "/usr/bin/pixstor-notify", line 64
print f.read().strip()
^
SyntaxError: invalid syntax
(base) skgtmdf@rds-gw-007:~ $
But I don't know what it means!
However, the screen is clearly still there as the output files continue to accumulate in the output destination!!
If you added the ampersand symbol (
&
) at the end of your command, you have set it to run in the background. That means it will run even after you log out, and will continue so until it is done, encounters the error, runs out of disk space, or the actual server is turned off. If you logged out from your original screen, however, your command most likely will not produce any more screen output.What you are referring to as
screen
still being there is actually aprocess
that is still active. You can check the running processes usingtop
.I don't see any mention of the
&
command. Also, commands run in the bg end on logout unlessdisown
ed.partially correct indeed. Though absolutely not advised to use if you plan on logging out from your session. In that case screen is your best/only option.
Moreover the process will be killed as soon as it tries to print something to either STDERR or even STDOUT as those stream are not available anymore after log-out.
No '&' in the command I'm afraid.
I'm still experiencing the same problem. I set three screens going, detached from them. An hour later my vpn disconnected. When I reconnected and ssh back in, the screens have disappeared and
screen -ls
shows no sockets. However, the output files continue to accumulate in the output directory.top
shows processes running, but I don't think it's possible to see what the actual process is, and I don't think it helps me re-enter the screen??did you detach your screen session before you logged out? (ctrl-a + d ) If not it will become a ghost process (which you will indeed see in the process list, but you likely can't access it anymore).
EDIT: usually you run screen session on a server (== some computer system that does not shut down) or your desktop in the lab (if you keep that one running)
Think Lieven is right, sounds like you arent detaching the screen session correctly. Should be no need for ampersands or
disown
ing unless you want to continue to use the screen session and avoid having your CLI locked up.Yes, I detached. Last night I set a long process going in a screen on my server, detached, then during the night my vpn dropped out. This morning I reconnected, and
screen -ls
shows no sockets. However, the output files continue to accumulate in the output directory.I don't know what I did, but the ghost screen just reappeared when I ran
screen -ls
. I've done quite a lot in the meantime, but it includes creating other screen windows. Any idea what the problem is anyone?Strange - long shot, but maybe you need to update or reinstall screen itself?
What happens if you do the following immediately after one another?: