Last active
August 29, 2015 13:59
-
-
Save vanhalt/10876387 to your computer and use it in GitHub Desktop.
Bash processes a.k.a playing with 'ps'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps -eo pid,command | grep 'writer' | cut -d ' ' -f 1 | xargs -I proceso kill -9 proceso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for a in $(seq 1 4) | |
do | |
bash writer_script.sh $a & | |
WAITPIDS="$WAITPIDS "$! | |
done | |
wait $WAITPIDS | |
echo "Script has finished" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# write some random data | |
for numero in $(seq 1 1000) | |
do | |
ruby -e 'puts rand(1..200)' >> votes_bash_$1.csv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment