I want to tar four directories which contain large number of small files using a shell script. Because of this script takes too long to execute so I want to make these 4 tar commands run in parallel using shell script hoping I can make better use of resources available.
Commands that I am currently using:
tar cf - /ebs/uat/uatappl | gzip -c > /ebs/backup/uatappl.tar.gz
tar cf - /ebs/uat/uatcomn | gzip -c > /ebs/backup/uatcomn.tar.gz
tar cf - /ebs/uat/uatora | gzip -c > /ebs/backup/uatora.tar.gz
tar cf - /ebs/uat/uatdata | gzip -c > /ebs/backup/uatdata.tar.gz
Best Answer
You can put all the tars in background like this:
But be aware you must have enough processor power and fast disk, otherwise the concurrency will make total execution longer than consecutive one