File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ AUTOSAVE_INTERVAL=10
3131# The number of autosaves to use for rotation
3232AUTOSAVE_SLOTS=3
3333
34+ # Save the command/chat/log on server start? Default location /opt/factorio/server.out
35+ # Setting this to 0 will cause the script to erase the log file on each start
36+ # If you set this to 1 you might want to apply logrotate on the log or it will eventually fill your disk
37+ SAVELOG=0
38+
3439# Factorio comes packaged in a tarball containing the directory named "factorio"
3540# when using this scripts update/install command we expect to see this very
3641# directory. If you want to supply your own update/install tar other than what you can download
Original file line number Diff line number Diff line change @@ -99,6 +99,10 @@ if ! [ $1 == "install" ]; then
9999 CMDOUT=" ${WRITE_DIR} /server.out"
100100 fi
101101
102+ if [ -z " ${SAVELOG} " ]; then
103+ SAVELOG=0
104+ fi
105+
102106 # Finally, set up the invocation
103107 INVOCATION=" ${BINARY} --config ${FCONF} --port ${PORT} --start-server-load-latest --server-settings ${SERVER_SETTINGS} --autosave-interval ${AUTOSAVE_INTERVAL} --autosave-slots ${AUTOSAVE_SLOTS} --latency-ms ${LATENCY} ${RCON} ${EXTRA_BINARGS} "
104108
@@ -164,7 +168,12 @@ start_service() {
164168 return 1
165169 fi
166170
167- as_user " tail -f ${FIFO} |${INVOCATION} > ${CMDOUT} 2>&1 & echo \$ ! > ${PIDFILE} "
171+ if [ " ${SAVELOG} " == " 0" ]; then
172+ debug " Erasing log ${CMDOUT} "
173+ echo " " > ${CMDOUT}
174+ fi
175+
176+ as_user " tail -f ${FIFO} |${INVOCATION} >> ${CMDOUT} 2>&1 & echo \$ ! > ${PIDFILE} "
168177
169178 ps -p $( cat ${PIDFILE} ) > /dev/null 2>&1
170179 if [ " $? " -ne " 0" ]; then
You can’t perform that action at this time.
0 commit comments