LoginSignup
0
0

More than 5 years have passed since last update.

crontabでAWS CLIの実行結果の出力が一部で途切れた

Posted at

crontabにてAWS CLIでjsonでデータ取得しファイルに保存しようとしたけど
なぜか途中で途切れてハマった次第

describeした時、TAGの内容も出力されていたが、
crontabで実行させるとその日本語文字列部分からすっぱり途切れてたので、
もしかして・・とTAGの内容をアルファベットにしてみたら次に日本語文字列のところで途切れる・・

PYTHONIOENCODING=UTF-8 も試したがうまく行かず・・
あとは、環境変数のLANGかLC_ALLのどちらかかな?と試したところ
LC_ALL環境変数うまくいきました。

例)セキュリティグループをdescribeした場合

#!/bin/sh

#今回の肝はコレ
export LC_ALL=ja_JP.UTF-8

/usr/local/bin/aws ec2 describe-security-groups >  describe-security-groups.json
0
0
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
0
0