This is a Bash Script vor Linux. With it can you run Programs in the backround this has the advantage, when you colse the connection the Program continues.
In this example i chose Minecraft and my file means mcStart.sh . You can change the Programm on line 45.

Install:

1.You Copy this Code in a file, add the Config and save it as bash file.
2.Add rights with the comand „chmod u+x mcStrat.sh“ (You need Root rights)

Comands:

./mcStrat.sh start #Start Server.
./mcStrat.sh stop #Stop Server. Since Minecraft save the World all 15min you can lose data when you stop it without having to save!
./mcStrat.sh status #Check is Server running.
./mcStrat.sh console #Open the Console of Program. You can close the console with CTRL + A and D.


###############################
#  Minecraft Startscript      #
#   Created by Rainbow-six3   #
# Visite www.rainbow-six3.com #
###############################    


#######CONFIG########
# add your settings #			#######EXAMPLE#######
SERVERNAME=""					#SERVERNAME="Mineraftserver" (screen name)
SHORTSERVERNAME=""				#SHORTSERVERNAME="MC" (Console output)


######SCRIPT#############
# Dont change anything!!!
COMMANDLINE_COMMAND="${1}"
COMMANDLINE_MODE="${2}"
function nocommand(){
        echo ${SHORTSERVERNAME}":  Add the Command start , stop , status or console in the Commandline"
        echo ${SHORTSERVERNAME}":  Example:"
        echo ${SHORTSERVERNAME}":  ./mc.sh start"
        exit 5
}
function noconf(){
		echo "     ###############################"
		echo "     #  Minecraft Startscript #"
		echo "     #   Created by Rainbow-six3   #"
		echo "     # Visite www.rainbow-six3.com #"
		echo "     ###############################"  
        echo "##Add Configuration in the Startscript!!##"
		exit 5
}
if [ -z $SERVERNAME ]; then
                noconf
fi
if [ -z $SHORTSERVERNAME ]; then
                noconf
fi
case $COMMANDLINE_COMMAND in
        start)
				if [[ `screen -ls | grep $SERVERNAME` ]];then
					echo ${SHORTSERVERNAME}":  Server is already running"
					exit 5
				fi
				screen -A -m -d -S ${SERVERNAME} ./MCMA2_Linux_x86_64
				echo ${SHORTSERVERNAME}":  Server started"
				exit 5
		;;
        stop)
            if [[ `screen -ls | grep $SERVERNAME` ]];then
				screen -r ${SERVERNAME} -X quit
				echo ${SHORTSERVERNAME}": Server is stopped"
				exit 5
			else
				echo ${SHORTSERVERNAME}": No Server is running"
			fi
		;;
        status)
             if [[ `screen -ls | grep $SERVERNAME` ]];then
				echo ${SHORTSERVERNAME}": Server is already running"
			else
				echo ${SHORTSERVERNAME}": Server is down"
			fi
			exit 5
		;;
		console)
			if [[ `screen -ls | grep $SERVERNAME` ]];then
		        screen -x ${SERVERNAME}
			else
				echo ${SHORTSERVERNAME}": Server is down"
				exit 5
            fi
		;;
        *)
            nocommand
esac

Proper nutrition is an significant part of leading a good lifestyle. But can drugs help us? Many families know that drugs are made to help us, but they can harm us if taken incorrectly. There are medications intended only for women. Below are some basic reasons about „Over the Counter Anxiety Medicine„. Is it possible to prevent side effects of Viagra? What health care providers talk about „Best over the counter weight loss pills„? Matters, like „Over the Counter Diet Pills„, are connected a lot of types of soundness problems. Usually, having nuisance getting an erection can be embarrassing. This medicine is for you only. Never give your medicaments to other folk even if them symptoms to be the same as yours.

Schreibe einen Kommentar