Created
October 11, 2017 01:48
-
-
Save yamamoto-febc/a9bd55ca02c992eef4c0819dc0edb088 to your computer and use it in GitHub Desktop.
さくらのクラウド スタートアップスクリプトでのベストプラクティス(motdで通知編) ref: http://qiita.com/yamamoto-febc/items/d3b498f53c7d973f3e59
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
| _motd() { | |
| LOG=$(ls /root/.sacloud-api/notes/*log) | |
| case $1 in | |
| start) | |
| echo -e "\n#-- Startup-script is \\033[0;32mrunning\\033[0;39m. --#\n\nPlease check the log file: ${LOG}\n" > /etc/motd | |
| ;; | |
| fail) | |
| echo -e "\n#-- Startup-script \\033[0;31mfailed\\033[0;39m. --#\n\nPlease check the log file: ${LOG}\n" > /etc/motd | |
| exit 1 | |
| ;; | |
| end) | |
| cp -f /dev/null /etc/motd | |
| ;; | |
| esac | |
| } |
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
| # 開始時 | |
| _motd start | |
| # エラー発生時 | |
| _motd fail | |
| # 終了時 | |
| _motd end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment