committed by
							
								 Jacob Gustafson
								Jacob Gustafson
							
						
					
				
				 5 changed files with 58 additions and 1 deletions
			
			
		| @ -0,0 +1,14 @@ | |||
| [Unit] | |||
| description "Job that runs mts-ENLIVEN minetest server as specific user" | |||
| After=network.target | |||
| 
 | |||
| [Service] | |||
| Type=simple | |||
| Environment=statedir=/var/cache/mts-ENLIVEN | |||
| ExecStartPre=/usr/bin/mkdir -p ${statedir} | |||
| User=owner | |||
| Group=owner | |||
| ExecStart=/home/owner/minetest/bin/minetestserver --gameid ENLIVEN --worldname FCAGameAWorld | |||
| 
 | |||
| [Install] | |||
| WantedBy=multi-user.target | |||
| @ -1,5 +1,27 @@ | |||
| #!/bin/sh | |||
| 
 | |||
| #enable the mts-ENLIVEN upstart service (after you've copied it) on Ubuntu: | |||
| #This is a systemd startup unit, and will only work if your system is running systemd | |||
| #(see https://wiki.ubuntu.com/SystemdForUpstartUsers or https://www.freedesktop.org/software/systemd/man/systemd.service.html | |||
| # and https://www.freedesktop.org/software/systemd/man/systemd.exec.html# --discusses execution options such as User) | |||
| #* Ignores invalid directives and starts the service ... | |||
| #  systemd-analyze verify <unit> file to get warnings on typos and badly formatted options. | |||
| #* requires full path, so ExecStart=/bin/sleep 20 works but ExecStart=sleep 20 does not. | |||
| 
 | |||
| 
 | |||
| ## Known Issues | |||
| # * should use machinectl shell instead of su or sudo as of 2016 updates to systemd | |||
| # * Restart=on-abort and RestartSec=3 settings could be used (but probably shouldn't, so minetest crash can be noticed [and debugged more easily by viewing tail of debug log]) | |||
| # * Maybe for ExecStart, instead use: | |||
| #   su owner "screen -S MinetestServer /home/owner/minetest/bin/minetestserver --gameid ENLIVEN --worldname FCAGameAWorld" | |||
| #   OR | |||
| #   sudo -u owner screen -S MinetestServer /home/owner/minetest/bin/minetestserver --gameid ENLIVEN --worldname FCAGameAWorld | |||
| #   instead of User=owner | |||
| 
 | |||
| #Update the unit: | |||
| wget https://github.com/expertmm/EnlivenMinetest/raw/master/etc/change_hardcoded_username_first/mts-ENLIVEN.service | |||
| echo "This will only work if you are using systemd." | |||
| sudo mv -f mts-ENLIVEN.service /etc/init.d/ | |||
| #? sudo mv -f mts-ENLIVEN.service /etc/systemd/system/ | |||
| #enable the mts-ENLIVEN systemd service on Ubuntu: | |||
| sudo service mts-ENLIVEN enable | |||
| sudo service mts-ENLIVEN start | |||
|  | |||
| @ -0,0 +1,8 @@ | |||
| #!/bin/sh | |||
| 
 | |||
| echo "This doesn't work on Xenial since Ubuntu switched from Canonical upstart to systemd (unless you manually switched to upstart)" | |||
| wget https://github.com/expertmm/EnlivenMinetest/raw/master/etc/change_hardcoded_username_first/upstart_version/etc/init.d/mts-ENLIVEN.conf | |||
| sudo mv -f mts-ENLIVEN.conf /etc/init.d/ | |||
| #enable the mts-ENLIVEN upstart service on Ubuntu: | |||
| sudo service mts-ENLIVEN enable | |||
| sudo service mts-ENLIVEN start | |||
| @ -0,0 +1,13 @@ | |||
| description "Job that runs mts-ENLIVEN minetest server as specific user" | |||
| 
 | |||
| # start in normal runlevels when disks are mounted and networking is available | |||
| start on runlevel [2345] | |||
| 
 | |||
| # stop on shutdown/halt, single-user mode and reboot | |||
| stop on runlevel [016] | |||
| 
 | |||
| #env statedir=/var/cache/mts-ENLIVEN | |||
| # create a directory needed by the daemon | |||
| #pre-start exec mkdir -p "$statedir" | |||
| 
 | |||
| exec sudu -u owner /home/owner/mts-ENLIVEN | |||
					Loading…
					
					
				
		Reference in new issue