Wow that was fast....
here is the script below, I have add the >> some.log in multiple place to try and capture the info, no luck (I know bad practice).
Using
script.move.sh >> some.log 2>some.log at prompt will not work due to the sequence of exictuion and write out.
-Dave
#!/bin/bash
filetime=$(date +'%Y%m%d')
gam_command(){
OAUTHFILE=oauth.txt-admin$x python /Applications/GAM/gam.py update user "$email" org Members >> "$filetime".MOVE.TO.MEMBERS.LOG
}
IFS=:
x=1
while read _MailALias email; do
email=${email//\"/}
echo "$email" >> "$filetime".MOVE.TO.MEMBERS.LOG
gam_command $email $x && echo "$email" >> "$filetime".MOVE.TO.MEMBERS.LOG &
while (( $(jobs | wc -l) >= 5 )); do
sleep 0.25
jobs > /dev/null
done
x=$(($x+1))
if [ $x -gt 5 ]
then
x=1
fi
done < "$@"
wait