Im just getting into scripting in linux so i decided to make myself a script for starting a linux server for et, it hasnt got too many features i was trying to make it modular so i can add bits easy. Just a wee learning thing for me would appreciate comments.
#HTs server start script
clear
echo Please choose a game mode For ET
OPTIONS="Campaign SW Objective LMS Quit"
select opt in $OPTIONS; do
#defaults
function default {
MOTD="HTs server"
HOSTNAME="^1HTs ^7ET server"
VSTR="d1"
}
#Server start command
function etload {
screen etded +set com_hunkmegs 64 +set sv_maxrate 9000 +set com_zonemegs 32 +set dedicated 2 +set sv_hostname "$HOSTNAME" +set g_motd "$MOTD" +exec $SCRIPT +vstr $VSTR
}
#Submenus for all but campaign
function menus {
clear
echo Mode: $MODE
OPTIONS="Default Custom Exit"
select opt in $OPTIONS; do
clear
if [ "$opt" = "Default" ]; then
echo Default settings select $MODE
default
SCRIPT="$MODECYCLE"
elif [ "$opt" = "Custom" ]; then
custom
elif [ "$opt" = "Exit" ]; then
echo exiting
exit
else
echo bad option
fi
etload
done
}
#Custom submenu
function custom {
echo Enter script name eg $MODECYCLE
read SCRIPT
echo +vstr Command if any eg d1
read VSTR
echo input MOTD eg HT kicks arse
read MOTD
echo input HOSTNAME eg HTs cool server
read HOSTNAME
}
#Exit option
if [ "$opt" = "Quit" ];
then
echo done
exit
#Campaign option
elif [ "$opt" = "Campaign" ]; then
echo Campaign
echo Please choose Rotation scripts
clear
echo Select what settings you want.
OPTIONS="Default Custom Exit"
select opt in $OPTIONS; do
MODE="Campaign"
MODECYCLE="campaigncycle.cfg"
clear
if [ "$opt" = "Default" ]; then
echo Default settings select campaign
SCRIPT="campaigncycle.cfg"
default
OPTIONS="Africa Europe Exit"
select opt in $OPTIONS; do
clear
if [ "$opt" = "Africa" ]; then
VSTR="d1"
elif [ "$opt" = "Europe" ]; then
VSTR="d2"
elif [ "$opt" = "Exit" ]; then
echo exiting
exit
else
echo bad option
fi
etload
done
elif [ "$opt" = "Custom" ]; then
custom
fi
etload
done
#Stop Watch option
elif [ "$opt" = "SW" ]; then
echo stopwatch
echo Please choose Rotation scripts
clear
MODE="Stop Watch"
MODECYCLE="stopwatchcycle.cfg"
menus
etload
#Objective option
elif [ "$opt" = "Objective" ]; then
echo Objective
echo Please choose Rotation scripts
clear
MODE="Objective"
MODECYCLE="objectivecycle.cfg"
menus
etload
#Last man standing option
elif [ "$opt" = "LMS" ]; then
echo lastman standing
echo Please choose Rotation scripts
clear
MODE="Last Man Standing"
MODECYCLE="lmscycle.cfg"
menus
etload
else
clear
echo bad option
fi
done