linux - how to get exit code when using xargs (parallel) -
i'd made script launching parallel rsync process:
#! /bin/bash list=$1 dest_dir=$2 rsync_opts=$3 #echo "rsyncing from=$src_dir to=$dest_dir rsync_opts=$rsync_opts" echo $list|xargs -n1 -d, echo|xargs -n1 -p 0 -i% rsync --rsync-path='sudo rsync' ${rsync_opts} % ${dest_dir}
then, have problems exit status of rsync process. know possible array of pipestatus, need catch exit code know if rsync made or not.
anyone knows?
the man page xargs shows possible exit status values, can produce single aggregated exit code, not exit code per child runs. try 1 of these options:
- have process xargs spawns print exit code , have parent task parse exit code outputs determine exit code each rsync.
- use gnu parallel
--joblog
option. create file containing commands run in parallel along exit code , other information. file parsed afterparallel
exits determine rsync commands failed , respective error codes.
Comments
Post a Comment