File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ AUTOSAVE_INTERVAL=10
31
31
# The number of autosaves to use for rotation
32
32
AUTOSAVE_SLOTS=3
33
33
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
+
34
39
# Factorio comes packaged in a tarball containing the directory named "factorio"
35
40
# when using this scripts update/install command we expect to see this very
36
41
# 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
99
99
CMDOUT=" ${WRITE_DIR} /server.out"
100
100
fi
101
101
102
+ if [ -z " ${SAVELOG} " ]; then
103
+ SAVELOG=0
104
+ fi
105
+
102
106
# Finally, set up the invocation
103
107
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} "
104
108
@@ -164,7 +168,12 @@ start_service() {
164
168
return 1
165
169
fi
166
170
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} "
168
177
169
178
ps -p $( cat ${PIDFILE} ) > /dev/null 2>&1
170
179
if [ " $? " -ne " 0" ]; then
You can’t perform that action at this time.
0 commit comments