I am running some tasks that might take 3-4months to complete (datasets transfer) on remote server via ssh, so I used screen
to run a python scripts doing the job.
Unfortunately, connection breaks after running for like 6-8 days (this happen twice), despite that I correctly detached all screen
sessions (Ctrl+a d
)so I have to start all over again (to avoid duplicate in datasets transferred).
root$screen -r
There are several suitable screens on:
7567.noiselevel_script (Detached)
6046.airquality_script (Detached)
1448.weather_script (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
root$screen -r 6046.airquality_script
595997it [167:43:10, 1.01s/it]
{"particles": null, "O3": 1.4509, "dateObserved": "2015-06-16T21:54:54+01:00", "name": "FEUP I-181 Calibration", "location": {"coordinates": [-8.594866, 41.178031]}}
595998it [167:43:11, 1.01s/it]
{"particles": null, "O3": 1.50961, "dateObserved": "2015-06-16T21:54:55+01:00", "name": "FEUP I-181 Calibration", "location": {"coordinates": [-8.594866, 41.178031]}}
595999it [167:43:12, 1.01s/it]
{"particles": null, "O3": 1.47883, "dateObserved": "2015-06-16T21:54:58+01:00", "name": "FEUP I-181 Calibration", "location": {"coordinates": [-8.594866, 41.178031]}}
596000it [167:43:13, 1.01s/it]connection already closed
You can see the connection already closed message above, the script stops after the 596000it
iteration (no longer running again)
May I know how to achieve one of the options below to avoid this frustration:
- Avoid this
connection already closed
problem so the python script run until all datasets are completely transferred, OR - Have some way to continue fetching dataset from source database from where the script broke last.