From 64b786598e5b831977f68b89cd3ecea3697acc2d Mon Sep 17 00:00:00 2001 From: sean Date: Mon, 22 Jul 2019 17:47:18 -0700 Subject: [PATCH] tweaks --- setup.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 2a98831..4727088 100644 --- a/setup.sh +++ b/setup.sh @@ -463,7 +463,7 @@ else fi # --content-filename=\"${hostname}.ssh.key\" --content-name=\"${hostname}.ssh.key\" echo "serverinfo=\`cat \"/home/${admin}/.ssh/id_rsa\"\`" >> /mnt/setup-chroot.sh -//echo "serverinfo=\"Server available at $connection\\n\$serverinfo\"; echo \"\$serverinfo\" | mail -s \"$hostname SSH key\" -A \"/home/${admin}/.ssh/id_rsa\" -r \"${email}\" \"${admins}\"" >> /mnt/setup-chroot.sh +echo "serverinfo=\"Server available at $connection\\n\$serverinfo\"; echo \"\$serverinfo\" | mail -s \"$hostname SSH key\" -A \"/home/${admin}/.ssh/id_rsa\" -r \"${email}\" \"${admins}\"" >> /mnt/setup-chroot.sh #echo "echo " | mail -s \"$hostname SSH key\" -A \"/home/${admin}/.ssh/id_rsa\" -r \"${email}\" \"${admins}\"" >> /mnt/setup-chroot.sh echo "echo \"Done.\"" >> /mnt/setup-chroot.sh @@ -483,8 +483,20 @@ echo " exit 1">> /mnt/setup-chroot.sh echo "fi">> /mnt/setup-chroot.sh echo "echo \"Done.\"" >> /mnt/setup-chroot.sh -echo "echo \"0 0 * * 1 /zfshealth.sh\" | crontab" >> /mnt/setup-chroot.sh -echo "systemctl enable cron" >> /mnt/setup-chroot.sh +echo "echo \"\"" >> /mnt/setup-chroot.sh +echo "echo \"Enabling cron and adding ZFS health script...\"" >> /mnt/setup-chroot.sh +echo "errors=\$(echo \"0 0 * * 1 /zfshealth.sh\" | crontab 1>&2 2>/dev/null)" >> /mnt/setup-chroot.sh +echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh +echo ' echo "Failed to add zfshealth.sh to crontab - $errors"' >> /mnt/setup-chroot.sh +echo " exit 1">> /mnt/setup-chroot.sh +echo "fi">> /mnt/setup-chroot.sh +echo "errors=\$(systemctl enable cron 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh +echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh +echo ' echo "Failed to enable cron service - $errors"' >> /mnt/setup-chroot.sh +echo " exit 1">> /mnt/setup-chroot.sh +echo "fi">> /mnt/setup-chroot.sh +echo "echo \"Done.\"" >> /mnt/setup-chroot.sh + echo "exit 0" >> /mnt/setup-chroot.sh