Bash process timer


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash process timer
# 1  
Old 02-19-2016
Bash process timer

I have a bash with several processes in it, that I would like to include a progress bar or percentage complete. Below are two separate processes that, so the user knows that something is happening, there is an an indicator for each process.

Maybe, at the start of each new process a printf the for loop followed by another printf when the process completes. I'm not quite sure if this is the best thing to do. Thank you Smilie.


Code:
# create BAM Index
for f in /home/cmccabe/Desktop/NGS/API/2-12-2015/*.bam ; do
     bname=`basename $f`
     pref=${bname%%.bam}
     samtools index $f
done

# strip off @PG tags
for f in /home/cmccabe/Desktop/NGS/API/2-12-2015/*.bam ; do
     bname=`basename $f`
     pref=${bname%%.bam}
     samtools view -H $f | sed '/^@PG/d' | samtools reheader - $f > /home/cmccabe/Desktop/NGS/API/2-12-2015/${pref}_newheader.bam
done

# 2  
Old 02-19-2016
I think you may want bash coprocesses as a starting suggestion.

https://www.gnu.org/software/bash/ma...processes.html
# 3  
Old 02-19-2016
Hi.

Google search progress mechanisms for bash produces about half a million hits, including spinners, bars, etc., and at least one right here need suggestion how to use the progress bar while executing shell ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash-awk to process thousands of files

Hi to all, I have thousand of files in a folder with names with format "FILE-YYYY-MM-DD-HHMM" for what I want to send the following AWK command awk '/Code.*/' FILE-2014* I'd like to separate all files that have the same date to a folder named with the corresponding date. For example, if I... (7 Replies)
Discussion started by: Ophiuchus
7 Replies

2. Shell Programming and Scripting

Help about bash process

I have function f1 and f2, I want it excute five items with different function in the list the the same time with process. I did a testing in start_build_feature1, it sleep about 100s, in the sleeping start_build_feature2 print nothing, can someone help me modify this scripts I don't when... (2 Replies)
Discussion started by: yanglei_fage
2 Replies

3. Shell Programming and Scripting

Bash process output analysis

Looking to create a script to listen to each output from a task while it is running and launch a function if a specific error message is found at any point and if not to continue uninterrupted. #!/bin/bash read checker <<< $(reaver -i mon0 -b 'target bssid' -vv) if ; then function elif... (1 Reply)
Discussion started by: 3therk1ll
1 Replies

4. Shell Programming and Scripting

Bash - countdown timer

Hello, I have another problem with my script - I would like to have a countdown timer visible on the screen, and at the same time, I want te be able to do something else. And when the time runs out, I need to know about that inside the script somehow and do some action. I guess that would require 2... (3 Replies)
Discussion started by: xqwzts
3 Replies

5. Shell Programming and Scripting

bash: closing file descriptors from a process

Below is a test script to illustrate a problem from a larger script I am writing. $ cat /tmp/loggingtest #!/bin/bash lvcreate -s -l 100%FREE -n var-data-snapshot vg00/var-data 2> >(logger -t "loggingtest.crit") 1> >(logger -t "loggingtest.info") sync & wait lvremove -f... (1 Reply)
Discussion started by: jelloir
1 Replies

6. Shell Programming and Scripting

[KSH/Bash] Starting a parent process from a child process?

Hey all, I need to launch a script from within 2 other scripts that can run independently of the two parent scripts... Im having a hard time doing this, if anyone knows how please let me know. More detail. ScriptA (bash), ScriptB (ksh), ScriptC (bash) ScriptA, launches ScriptB ScirptB,... (7 Replies)
Discussion started by: trey85stang
7 Replies

7. Cybersecurity

Take over a Bash-process.

Hi! I'm not really sure if this is the right forum to post this thread in but I'll try anyway. I was just wondering if it's possible to "take over" a Bash process? For example, if a user is logged in to my server (where I'm root) can I then somehow "clone" his session so I can see what he's... (1 Reply)
Discussion started by: k1piee
1 Replies

8. Shell Programming and Scripting

Catching SIG of running process with bash

Hello all! I'm writing a script that will catch when an outside process crashes (SIGHUP, right?) without having to loop into infinity. With that in mind, I came across the trap utility and thought if could be used to monitor another process other than it's own. But from what I've read, I'm... (1 Reply)
Discussion started by: mashiox
1 Replies

9. Shell Programming and Scripting

starting a bash session as child process to another bash session from a process

Hi I want to do something that might sound strange. I have a code that in written in C and is executed at startup (it's a custom process). It occasionally calls some bash scripts. The process doesn't have any terminal associated with it. One thing I don't know how to do is to start a... (5 Replies)
Discussion started by: alirezan
5 Replies

10. Shell Programming and Scripting

Startup Script "run process with Timer"

Hi I have a script that execute every X minute for checking new files in a folder and converting to pdf. Is there any way to start this script automatically on linux startup?. I use sleep function in script with infinite loop. while do killall -u `whoami` -q soffice soffice... (0 Replies)
Discussion started by: zawmn83
0 Replies
Login or Register to Ask a Question