Kill Nohup Bash Process - Biostars

Latest Open Jobs Tutorials Tags About FAQ Community Planet New Post Log In New Post Latest Open News Jobs Tutorials Forum Tags Planet Users Log In Sign Up About Kill nohup bash process 1 0 Entering edit mode 6.7 years ago genomes_and_MGEs ▴ 10

Hey guys,

I ran this

nohup bash -c 'for next in $(cat all_bacteria_links.txt); do wget -P all_bacteria "$next"/*genomic.fna.gz; done',

and now I want to kill the process. I ran the command in ssh server, so whenever I try to kill PID or kill -9 PID, the server connection closes. Can you please let me know how I can kill this process? Thanks!

genome sequence • 10k views ADD COMMENT • link updated 6.7 years ago by Santosh Anand 5.8k • written 6.7 years ago by genomes_and_MGEs ▴ 10 1 Entering edit mode

Not a bioinfo Q. Still, this might help you https://stackoverflow.com/questions/17385794/how-to-get-the-process-id-to-kill-a-nohup-process

ADD REPLY • link 6.7 years ago by Santosh Anand 5.8k 0 Entering edit mode

You're killing the wrong bash process.

ADD REPLY • link 6.7 years ago by Devon Ryan 105k 0 Entering edit mode

Do ps -ef | grep all_bacteria_links and kill the right process.

ADD REPLY • link 6.7 years ago by WouterDeCoster 48k 2 Entering edit mode

Pro tip: use a decoy character class with the grep following the ps to avoid listing the grep as one of the candidates.

ps -ef | grep "[a]ll_bacteria_links"

The pattern [a]ll doesn't match the string "[a]ll", so the grep process won't be picked.

ADD REPLY • link 6.7 years ago by Ram 45k 1 Entering edit mode

OP has a very convoluted way to run the command by running a bash shell with nohup, so the process to kill is bash.

ADD REPLY • link 6.7 years ago by Santosh Anand 5.8k 2 Entering edit mode

I believe there is a specific corner in hell for people who do this, no?

ADD REPLY • link 6.7 years ago by WouterDeCoster 48k 0 Entering edit mode

It doesn't work, because the PID is always changing on the server... So, I found a solution:

pkill -STOP -P the_ppid

Thanks anyway guys!

ADD REPLY • link 6.7 years ago by genomes_and_MGEs ▴ 10 8 Entering edit mode 6.7 years ago shenwei356 8.7k

Hi, I'd recommend using screen instead of nohup, screen is safer.

And, you better utilize some batch commands like parallel to accelerate thousands of jobs, here is wget.

Using wget -c to resume unfinished download is also recommended.

Here's my method in this case from Manipulation on NCBI refseq bacterial assembly summary

$ cat mt.tsv | csvtk cut -t -f ftp_path | sed 1d \ | rush -v prefix='{}/{%}' \ ' wget -c {prefix}_genomic.fna.gz; \ wget -c {prefix}_genomic.gbff.gz; \ wget -c {prefix}_genomic.gff.gz; \ wget -c {prefix}_cds_from_genomic.fna.gz \ wget -c {prefix}_protein.faa.gz; \ ' \ -j 10 -c -C download.rush

If the process died for some reasons like PC reboot or network interrupt, just re-run the command, which will ignore finished jobs recorded in file download.rush.

ADD COMMENT • link 6.7 years ago by shenwei356 8.7k 0 Entering edit mode

THIS is the right solution!

ADD REPLY • link 6.7 years ago by Santosh Anand 5.8k

Login before adding your answer.

Similar Posts Loading Similar Posts Traffic: 4654 users visited in the last hour Content Search Users Tags Badges Help About FAQ Access RSS API Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6

Tag » How To Stop Nohup Process