summaryrefslogtreecommitdiff
path: root/ec2-init
diff options
context:
space:
mode:
authorScott Moser <smoser@canonical.com>2009-09-25 17:11:24 +0200
committerSoren Hansen <soren@canonical.com>2009-09-25 17:11:24 +0200
commit2e5e426e406c4b72942020460993e5fb91dcb9b6 (patch)
treed8a0fbb75191a61a9414251346b58c04365fd839 /ec2-init
parent2fd7a079c19ce42c7705e9e87bc5e807d45891b2 (diff)
downloadvyos-cloud-init-2e5e426e406c4b72942020460993e5fb91dcb9b6.tar.gz
vyos-cloud-init-2e5e426e406c4b72942020460993e5fb91dcb9b6.zip
replace multiple '| logger' in regenerate_ssh_host_keys with a single one
This is a speed improvement as previous would make a fork/subshell for each pipe. This will only make a single fork. I've also verified that each line in logger output will still get the 'ec2' prefix $ printf "%s\n%s\n" "hi world" "by world" | logger -s -t ec2 2>/dev/null $ tail -n 2 /var/log/messages Sep 24 19:06:10 ip-10-242-225-190 ec2: hi world Sep 24 19:06:10 ip-10-242-225-190 ec2: by world The other thing to note is that I redirected stderr of the regenerate_ssh_host_keys call to logger, so it will go to the logs also.
Diffstat (limited to 'ec2-init')
-rwxr-xr-xec2-init22
1 files changed, 11 insertions, 11 deletions
diff --git a/ec2-init b/ec2-init
index abe2cc26..8af8896f 100755
--- a/ec2-init
+++ b/ec2-init
@@ -48,18 +48,18 @@ run_once_ever() {
regenerate_ssh_host_keys() {
rm -f /etc/ssh/ssh_host_*_key*
- ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N '' | logger -s -t "ec2"
- ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N '' | logger -s -t "ec2"
+ ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
+ ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
# This allows user to get host keys securely through console log
- echo | logger -s -t "ec2"
- echo | logger -s -t "ec2"
- echo "#############################################################" | logger -s -t "ec2"
- echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----" | logger -s -t "ec2"
- ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub | logger -s -t "ec2"
- ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub | logger -s -t "ec2"
- echo "-----END SSH HOST KEY FINGERPRINTS-----" | logger -s -t "ec2"
- echo "#############################################################" | logger -s -t "ec2"
+ echo
+ echo
+ echo "#############################################################"
+ echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----"
+ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
+ ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub
+ echo "-----END SSH HOST KEY FINGERPRINTS-----"
+ echo "#############################################################"
}
case "$1" in
@@ -75,7 +75,7 @@ case "$1" in
if run_once_per_ami ssh_host_key_regeneration
then
- regenerate_ssh_host_keys
+ regenerate_ssh_host_keys 2>&1 | logger -s -t "ec2"
fi
if run_once_ever ec2-defaults