Skip to content

Commit

Permalink
added update via crontab
Browse files Browse the repository at this point in the history
  • Loading branch information
simylein committed Dec 25, 2020
1 parent b229a47 commit 94da6f0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand All @@ -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]$ ]]
Expand All @@ -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:"
Expand Down

0 comments on commit 94da6f0

Please sign in to comment.