Restarting the Rootbot Imaging Script over SSH
There’s an unresolved memory leak in the imaging script on the Rootbot. Overtime it consumes ever more ram until the script is killed. Ideally we should rewrite the script or monitor it using systemd so that the script is automatically restarted when it crashes. This has not risen to the top of the todo list so the current work around is as follows:
About half way through an experiment,
ssh
into the rootbot’s pi.Check that pictures aren’t currently being taken by looking at the timestamps in the pictures directory (
ls -lh ~/Pictures
)Find the process id number (PID) for the script (
rootBotPhotoScript_23Feb2021.py
) (e.g. with
top
orhtop
)End the process with
kill $pid
where $pid is the value from step 3.go to the folder with the script (
cd \~/rootbot/jupyter_notebooks
).Restart the rootbot script (
rootBotPhotoScript_23Feb2021.py
). Don’t be fooled by the shebang line, python3 must be explicitly used. The command to do this isnohup python3 rootBotPhotoScript_23Feb2021.py &&
.nohup
and&&
ensure the process continues in the background after the terminal is closed. python3 ensures the system’s default python (2) isn’t used. The full path need not be provided for the script because the present working directory is the/jupyter_notebooks folder
.