Failing to save correctly on shutdown when shutdown takes over 15 seconds. Leaves corrupt/incomplete save file behind.
Script timeout when shutting down is 15 seconds. On slower machines with large save files, saving and shutting down takes over 15 seconds. This results in the process being killed mid-save, leaving behind a _autosave2.tmp.zip file. Next time server is started, Factorio attempts to load the most recent save in the saves folder, which is the corrupt/incomplete file, which causes Factorio to fail and quit.
System Information: Modded Factorio 1.1.50 running on AWS EC2 with m5a.large instance type (2 vCPU & 8 GiB RAM).
Workaround:
changing line 335 of the script from while [ "$sec" -le 15 ]; do to while [ "$sec" -le 30 ]; do fixed the issue.
Feature request/suggested fix:
Please add a setting to the config file to configure the timeout length.