Last active
July 2, 2019 12:41
-
-
Save Drac346/6abd1f52f1e5d390f91fb52e0cbac166 to your computer and use it in GitHub Desktop.
7 Days to Die Command Script for the Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Written on Ubuntu 16.04 LTS | |
#Written against Factorio 0.15.3 (tested again 0.15.35) | |
#walkthough: tbd | |
#props: https://gist.github.com/othyn/e1287fd937c1e267cdbcef07227ed48c | |
#disclaimer: stole the idea from someone (can't remember who, sorry), but modified it for my wants | |
#Requires Sudo for systemctl commands (start, stop, restart, ect) | |
clear | |
# Config | |
working_dir="/home/steam/7daysVanilla" | |
# End config | |
cd $working_dir || exit | |
7d2dStart() | |
{ | |
systemctl start 7d2d | |
} | |
7d2dStop() | |
{ | |
systemctl stop 7d2d | |
} | |
7d2dRestart() | |
{ | |
systemctl restart 7d2d | |
} | |
7d2dStatus() | |
{ | |
systemctl status 7d2d.service | |
} | |
7d2dTail() | |
{ | |
journalctl -u factorio.service -f | |
} | |
7d2dConsole() | |
{ | |
tail -n 45 -f /home/steam/7daysVanilla/7DaysToDieServer_Data/output_log.txt | |
} | |
7d2dPlayers() | |
{ | |
tail -n 45 -f /home/steam/7daysVanilla/7DaysToDieServer_Data/output_log.txt | grep PlayerLogin | |
} | |
7d2dInstall() | |
{ | |
./steamcmd.sh +login anonymous +force_install_dir ./7daysVanilla +app_update 294420 +quit | |
} | |
7d2dUpdate() | |
{ | |
./steamcmd.sh +login anonymous +force_install_dir ./7daysVanilla +app_update 294420 +quit | |
} | |
Usage () | |
{ | |
echo "Usage:" | |
echo "$0 [start|stop|restart|tail|console|Players|Install|Update]" | |
exit | |
} | |
for i in "$1" | |
do | |
case $i in | |
start) 7d2dStart;; | |
status) 7d2dStatus;; | |
stop) 7d2dStop;; | |
restart) 7d2dRestart;; | |
tail) 7d2dTail;; | |
console) 7d2dConsole;; | |
players) 7d2dPlayers;; | |
install) 7d2dInstall;; | |
update) 7d2dUpdate;; | |
*) Usage;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment