8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GNU parallel

Last updated at Posted at 2015-10-20

bash parallel 備忘録

並列処理をお手軽に実行したい際に有効なコマンド

smtp-cli コマンドを使用して MTAに負荷をかけたい場合など。

以下は、10並列でメール送信した例。色々奥が深いので、勉強しようと思います。

send-mail.sh
#!/bin/bash
./smtp-cli  --disable-starttls  --verbose   --server=xx.xx.xx.xx:25 \
   --mail-from=hogehoge@hogehoge.ne.jp   --rcpt-to=hoge@hogehoge.co.jp \
   --from=hogehoge@hogehoge.ne.jp  --to=hoge@hogehoge.co.jp   --subject=test-${1}
[user@hoge script]$ seq 1 10 | parallel --no-notice ./send-mail.sh {}
Connection from 172.16.117.131:51293 to 172.16.130.6:25
[220] 'hogehoge.ne.jp ESMTP'
> EHLO localhost
[250] 'hogeho.ne.jp'
[250] 'PIPELINING'
[250] 'SIZE 157286400'
[250] 'ETRN'
[250] 'STARTTLS'
[250] 'AUTH PLAIN LOGIN'
[250] 'AUTH=PLAIN LOGIN'
[250] 'ENHANCEDSTATUSCODES'
[250] '8BITMIME'
[250] 'DSN'
> MAIL FROM: <hogehoge@hogehoge.ne.jp>
[250] '2.1.0 Ok'
> RCPT TO: <hoge@hogehoge.co.jp>
[250] '2.1.5 Ok'
> DATA
[354] 'End data with <CR><LF>.<CR><LF>'
[250] '2.0.0 Ok: queued as EFE3B340037'
> QUIT
[221] '2.0.0 Bye'
Connection from xxx.xxx.xxx.xxx:xxxxx to xxx.xxx.xxx.xxx:25
[220] 'hogehoge.ne.jp ESMTP'
> EHLO localhost
[250] 'hogehoge.ne.jp'
[250] 'PIPELINING'
[250] 'SIZE 157286400'
[250] 'ETRN'
[250] 'STARTTLS'
[250] 'AUTH PLAIN LOGIN'
[250] 'AUTH=PLAIN LOGIN'
[250] 'ENHANCEDSTATUSCODES'
[250] '8BITMIME'
[250] 'DSN'
> MAIL FROM: <hogehoge@hogehoge.ne.jp>
....省略
8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?