From 94da6f0fdf2ae13071ca5c0dd609106b2ae2a82b Mon Sep 17 00:00:00 2001 From: simylein <67859356+simylein@users.noreply.github.com> Date: Fri, 25 Dec 2020 01:43:41 +0100 Subject: [PATCH] added update via crontab --- setup.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 0cdb868..20dc9b0 100644 --- a/setup.sh +++ b/setup.sh @@ -332,7 +332,7 @@ fi # crontab automatization restart read -p "Would you like to restart your server at 02:00? [Y/N]: " if [[ $REPLY =~ ^[Yy]$ ]] - then echo -e "${green}atomatic restarts at 02:00${nocolor}" + then echo -e "${green}automatic restarts at 02:00${nocolor}" crontab -l | { cat; echo "# minecraft ${servername} server restart at 02:00"; } | crontab - crontab -l | { cat; echo "00 02 * * * cd ${serverdirectory} && ${serverdirectory}/restart.sh"; } | crontab - crontab -l | { cat; echo ""; } | crontab - @@ -342,6 +342,19 @@ if [[ $REPLY =~ ^[Yy]$ ]] crontab -l | { cat; echo ""; } | crontab - fi +# crontab automatization restart +read -p "Would you like to update your server every Sunday? [Y/N]: " +if [[ $REPLY =~ ^[Yy]$ ]] + then echo -e "${green}automatic update at Sunday${nocolor}" + crontab -l | { cat; echo "# minecraft ${servername} server update at Sunday"; } | crontab - + crontab -l | { cat; echo "30 23 * * 00 cd ${serverdirectory} && ${serverdirectory}/update.sh"; } | crontab - + crontab -l | { cat; echo ""; } | crontab - + else echo -e "${yellow}no updates${nocolor}" + crontab -l | { cat; echo "# minecraft ${servername} server update at Sunday"; } | crontab - + crontab -l | { cat; echo "#30 23 * * 00 cd ${serverdirectory} && ${serverdirectory}/update.sh"; } | crontab - + crontab -l | { cat; echo ""; } | crontab - +fi + # crontab automatization startup read -p "Would you like to start your server at boot? [Y/N]: " if [[ $REPLY =~ ^[Yy]$ ]] @@ -355,6 +368,9 @@ if [[ $REPLY =~ ^[Yy]$ ]] crontab -l | { cat; echo ""; } | crontab - fi +# padd crontab with empty line +crontab -l | { cat; echo ""; } | crontab - + # finish messages echo -e "${green}setup is complete!${nocolor}" echo "If you would like to start your Server:"