Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ezaki
Last active January 12, 2018 16:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezaki/69cfa45d1341123538f354e14f1afbdf to your computer and use it in GitHub Desktop.
Save ezaki/69cfa45d1341123538f354e14f1afbdf to your computer and use it in GitHub Desktop.
ConoHa motd
#cloud-config
write_files:
- path: /usr/bin/conoha-motd
owner: root:root
permissions: '0755'
content: |
#!/bin/sh
echo -e "このホストは $(hostname) だよ!\nリソースの状態は\n$(vmstat)\nこんな感じ。\n更新日時は: $(date)だよー" \
| conohasay -c $([ $(($RANDOM % 2)) -eq 0 ] && echo conoha || echo anzu) -s m > /etc/motd
chmod 644 /etc/motd
runcmd:
- curl -sL https://github.com/hironobu-s/conohasay/releases/download/current/conohasay-linux.amd64.gz | zcat > /usr/bin/conohasay
- chmod +x /usr/bin/conohasay
- echo "*/5 * * * * conoha-motd > /dev/null 2>&1" | crontab -
- conoha-motd
#cloud-config
write_files:
- path: /usr/bin/conoha-motd
owner: root:root
permissions: '0755'
content: |
#!/bin/sh
cat <<EOF > /etc/motd
________ ________ ________ ________ ___ ___ ________
|\ ____\|\ __ \|\ ___ \|\ __ \|\ \|\ \|\ __ \
\ \ \___|\ \ \|\ \ \ \\ \ \ \ \|\ \ \ \\\ \ \ \|\ \
\ \ \ \ \ \\\ \ \ \\ \ \ \ \\\ \ \ __ \ \ __ \
\ \ \____\ \ \\\ \ \ \\ \ \ \ \\\ \ \ \ \ \ \ \ \ \
\ \_______\ \_______\ \__\\ \__\ \_______\ \__\ \__\ \__\ \__\
\|_______|\|_______|\|__| \|__|\|_______|\|__|\|__|\|__|\|__|
ip address: $(hostname -i)
Last update: $(date)
EOF
chmod 644 /etc/motd
runcmd:
- echo "*/5 * * * * conoha-motd > /dev/null 2>&1" | crontab -
- conoha-motd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment