Created
March 25, 2013 06:31
-
-
Save r-plus/5235273 to your computer and use it in GitHub Desktop.
圧縮と転送をひとまとめにしてバックグラウンドで実行して最後に待つ。(サブシェルとwaitはbash, csh, zshにあるのは確認)
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
| #!/bin/sh | |
| for DB in DB_A DB_B DB_C; do | |
| # something dump. | |
| dump database $DB | |
| # compress then scp in background. | |
| (gzip dumpfile; scp dumpfile.gz SERVER:/root) & | |
| done | |
| # wait all compress and scp. | |
| wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment