Skip to content

Instantly share code, notes, and snippets.

@vanhalt
Last active August 29, 2015 13:59
Show Gist options
  • Save vanhalt/10876387 to your computer and use it in GitHub Desktop.
Save vanhalt/10876387 to your computer and use it in GitHub Desktop.
Bash processes a.k.a playing with 'ps'
ps -eo pid,command | grep 'writer' | cut -d ' ' -f 1 | xargs -I proceso kill -9 proceso
#!/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"
# 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