Bugfix + Cleaner server_command handling
Fix a bug which was introduced by the new indentation (cat EOF). Tailf which is used to retrieve the server output closes itself as soon as the minecraft command is triggered. Since this functionality is build into tailf there is no need to reinvent the wheel.
This commit is contained in:
		
							parent
							
								
									761f7b2418
								
							
						
					
					
						commit
						2d367a746a
					
				
							
								
								
									
										2
									
								
								.SRCINFO
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								.SRCINFO
									
									
									
									
									
								
							| 
						 | 
					@ -27,7 +27,7 @@ pkgbase = minecraft-server
 | 
				
			||||||
	md5sums = c644abdf293c2f98033a64d732a4945c
 | 
						md5sums = c644abdf293c2f98033a64d732a4945c
 | 
				
			||||||
	md5sums = 5ed78e366146e47f8498347e93ad5423
 | 
						md5sums = 5ed78e366146e47f8498347e93ad5423
 | 
				
			||||||
	md5sums = d4656f27716fd78ab64344a517b07443
 | 
						md5sums = d4656f27716fd78ab64344a517b07443
 | 
				
			||||||
	md5sums = 1991eb0aedeba1dab2371f22a6736b47
 | 
						md5sums = 9011b19dc6218d41989835a6bba033e0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pkgname = minecraft-server
 | 
					pkgname = minecraft-server
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								PKGBUILD
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								PKGBUILD
									
									
									
									
									
								
							| 
						 | 
					@ -26,7 +26,7 @@ md5sums=('a0671390aa0691e70a950155aab06ffb'
 | 
				
			||||||
	'c644abdf293c2f98033a64d732a4945c'
 | 
						'c644abdf293c2f98033a64d732a4945c'
 | 
				
			||||||
	'5ed78e366146e47f8498347e93ad5423'
 | 
						'5ed78e366146e47f8498347e93ad5423'
 | 
				
			||||||
	'd4656f27716fd78ab64344a517b07443'
 | 
						'd4656f27716fd78ab64344a517b07443'
 | 
				
			||||||
	'1991eb0aedeba1dab2371f22a6736b47')
 | 
						'9011b19dc6218d41989835a6bba033e0')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package() {
 | 
					package() {
 | 
				
			||||||
	install -Dm644 minecraftd.conf              "${pkgdir}/etc/conf.d/minecraft"
 | 
						install -Dm644 minecraftd.conf              "${pkgdir}/etc/conf.d/minecraft"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										23
									
								
								minecraftd.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										23
									
								
								minecraftd.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| 
						 | 
					@ -130,11 +130,8 @@ server_command() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
 | 
						sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
 | 
				
			||||||
	if [ $? -eq 0 ]; then
 | 
						if [ $? -eq 0 ]; then
 | 
				
			||||||
		mc_command "$@"
 | 
							mc_command "$@" &
 | 
				
			||||||
		tailf -n 0 ${LOGPATH}/latest.log &
 | 
							tailf --pid=$! -n 0 ${LOGPATH}/latest.log &
 | 
				
			||||||
		TAILFPID=$! # Process id of tailf command
 | 
					 | 
				
			||||||
		sleep 0.1
 | 
					 | 
				
			||||||
		kill ${TAILFPID}
 | 
					 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		echo "There is no ${SESSION_NAME} session to connect to."
 | 
							echo "There is no ${SESSION_NAME} session to connect to."
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
| 
						 | 
					@ -152,18 +149,18 @@ server_console() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Help function, no arguments required
 | 
					# Help function, no arguments required
 | 
				
			||||||
help() {
 | 
					help() {
 | 
				
			||||||
	cat << 'EOF'
 | 
						cat <<- 'EOF'
 | 
				
			||||||
	This script was design to easily control any minecraft server. Quite every parameter for a given
 | 
						This script was design to easily control any minecraft server. Quite every parameter for a given
 | 
				
			||||||
	minecraft server derivative can be altered by editing the variables in the configuration file.
 | 
						minecraft server derivative can be altered by editing the variables in the configuration file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Usage: minecraftd {start|stop|status|backup|command <command>|console}
 | 
						Usage: minecraftd {start|stop|status|backup|command <command>|console}
 | 
				
			||||||
	start                Start the minecraft server
 | 
						    start                Start the minecraft server
 | 
				
			||||||
	stop                 Stop the minecraft server
 | 
						    stop                 Stop the minecraft server
 | 
				
			||||||
	restart              Restart the minecraft server
 | 
						    restart              Restart the minecraft server
 | 
				
			||||||
	status               Print some status information
 | 
						    status               Print some status information
 | 
				
			||||||
	backup               Backup the world data
 | 
						    backup               Backup the world data
 | 
				
			||||||
	command <command>    Run the given comman at the minecraft server console
 | 
						    command <command>    Run the given comman at the minecraft server console
 | 
				
			||||||
	console              Enter the server console through a screen session
 | 
						    console              Enter the server console through a screen session
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Copyright (c) Gordian Edenhofer <gordian.edenhofer@gmail.com>
 | 
						Copyright (c) Gordian Edenhofer <gordian.edenhofer@gmail.com>
 | 
				
			||||||
	EOF
 | 
						EOF
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user