Page 1 of 1
Headless save
Posted: Sun Aug 09, 2015 2:30 pm
by bruteman
Hey running the Headless on our VPS running good one instance where the server left the game so auto save etc stopped working.
Anyway the server is auto saving to _autosave 1-3 .zip so if you close the server to restart or it crashes as above do you always have to manually rename the _autosave files? as the server never seems to save to the main .zip file (in my case SERVER.zip)
or did i do something wrong in the setup?
batch file calling the server...
start Factorio.exe --start-server SERVER.zip --autosave-interval 10 --latency 12
Re: Headless save
Posted: Sun Aug 09, 2015 2:52 pm
by Oxyd
When the server receives SIGINT (press Control-C in the console window, I believe this should work on Windows as well), it will save to the file you loaded from and quit. If it crashes or you kill it in some forceful way, it obviously won't save anything.
You can also run /c game.server_save() from the game console (from any connected peer) to tell the server to save now to the file you loaded. (You can also run game.server_save('filename') if you want to save to some other file.)
Re: Headless save
Posted: Sun Aug 09, 2015 5:04 pm
by Bisa
The way I've opted to solve this in my
init script for linux is basically before starting the server I check the last modified save in the saves dir and make a copy of this to my --start-server save, in your case that would be pseudo code:
find last modified save
copy last modified save to SERVER.zip
start server
Re: Headless save
Posted: Mon Oct 12, 2015 4:30 pm
by ibsteveog
Oxyd wrote:When the server receives SIGINT (press Control-C in the console window, I believe this should work on Windows as well), it will save to the file you loaded from and quit. If it crashes or you kill it in some forceful way, it obviously won't save anything.
You can also run /c game.server_save() from the game console (from any connected peer) to tell the server to save now to the file you loaded. (You can also run game.server_save('filename') if you want to save to some other file.)
I run a headleess windows server (12.10) and Ctrl+C to kill the server does not trigger a save to the main file.
Like others, I have to go find the last autosave, accept the fact that it's going to be a bit of a rollback, and move that autosave into place.
Re: Headless save
Posted: Fri Jan 01, 2016 8:05 pm
by 2disbetter
Oxyd wrote:When the server receives SIGINT (press Control-C in the console window, I believe this should work on Windows as well), it will save to the file you loaded from and quit. If it crashes or you kill it in some forceful way, it obviously won't save anything.
You can also run /c game.server_save() from the game console (from any connected peer) to tell the server to save now to the file you loaded. (You can also run game.server_save('filename') if you want to save to some other file.)
I'm getting access denied when I attempt this. Is there a new method the server function is being called as a result of a code base change?
2d
Re: Headless save
Posted: Mon Jan 04, 2016 10:07 am
by Oxyd
2disbetter wrote:Oxyd wrote:When the server receives SIGINT (press Control-C in the console window, I believe this should work on Windows as well), it will save to the file you loaded from and quit. If it crashes or you kill it in some forceful way, it obviously won't save anything.
You can also run /c game.server_save() from the game console (from any connected peer) to tell the server to save now to the file you loaded. (You can also run game.server_save('filename') if you want to save to some other file.)
I'm getting access denied when I attempt this. Is there a new method the server function is being called as a result of a code base change?
2d
No, there isn't.
Which of the two ways are you attempting? And what error message exactly do you get? Are you sure Factorio has write access to the save file's location?
Re: Headless save
Posted: Wed Mar 23, 2016 11:12 pm
by Klynn
I was wondering if anyone knew a way to have a Windows or Linux shutdown tell the server to exit gracefully? I'm currently running a Windows VM for the server and it's a real pain every time Windows Updates or something else (like my rebooting the hypervisor) reboots the machine and the save doesn't get updated so I have to manually grab an autosave. I'm willing to switch to a CentOS server, and it seems like there's an init script that'll handle grabbing an autosave automatically, but it would still be nice to not be rolled back to an autosave in the event of a shutdown without terminating the server first.
I can't think of any methods on Windows, but I'm a real rookie with Linux so I don't even know where to start on that one.
Is this possible?
Re: Headless save
Posted: Sun May 01, 2016 7:08 pm
by Bisa
Klynn wrote:I was wondering if anyone knew a way to have a Windows or Linux shutdown tell the server to exit gracefully? I'm currently running a Windows VM for the server and it's a real pain every time Windows Updates or something else (like my rebooting the hypervisor) reboots the machine and the save doesn't get updated so I have to manually grab an autosave. I'm willing to switch to a CentOS server, and it seems like there's an init script that'll handle grabbing an autosave automatically, but it would still be nice to not be rolled back to an autosave in the event of a shutdown without terminating the server first.
I can't think of any methods on Windows, but I'm a real rookie with Linux so I don't even know where to start on that one.
Is this possible?
sorry for being a bit late to the party - 0.12.31 fixed the graceful shutdown save, simply sending a SIGTERM equivalent on windows will save the map, ie if you gracefully shut down the process it will save to your designated save.zip file