Last active
November 14, 2019 15:44
-
-
Save jvmvik/e629ecbf8955b5a95023725c59fb6550 to your computer and use it in GitHub Desktop.
Run tar in parallel
This file contains hidden or 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 ruby | |
| # | |
| # run gtar in parallel | |
| # | |
| l = Dir.glob("summary/*") | |
| names = l.map { |e| File.basename(e[0]).split("_")[0] }.uniq | |
| list = names.map do |user| | |
| spawn(%Q(gtar cvf archive+#{user}_2019-11-14.tgz log/#{user}*.log)) | |
| end | |
| puts list.size | |
| Process.wait | |
| puts 'done' | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment