Skip to content

Instantly share code, notes, and snippets.

@r-plus
Created March 25, 2013 06:31
Show Gist options
  • Select an option

  • Save r-plus/5235273 to your computer and use it in GitHub Desktop.

Select an option

Save r-plus/5235273 to your computer and use it in GitHub Desktop.
圧縮と転送をひとまとめにしてバックグラウンドで実行して最後に待つ。(サブシェルとwaitはbash, csh, zshにあるのは確認)
#!/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