Rending animations with Blender is a log running process. It is possible to keep an ssh session open for the duration of the render but we can use use tmux to keep the blender process running in the background.
tmux
~/blender/blender -b -b ~/BlenderFile.blend -E CYCLES -S << SceneName >> -s << StartFrame >> -e << End Frame >> -a -- --cycles-device CUDA > ~/blender_log.txt &
tmux detach
Now it doesn’t matter if the ssh session gets disconnected for whatever reason :-)
Note: Instead of using the ampersand character (’&’), you can run the task in the foreground, press Ctrl-Z to pause and type ‘bg’ to move to the background.