When I first got started with a Raspberry Pi, I would often use it to tackle some long running scripts – like the continuous monitoring of a video feed, or a small script that gathered data from the web. The problem I faced was how to stay connected to the Pi long enough so that the script wouldn’t terminate.
Source: LXer – How To Run Long-running Scripts on a Raspberry Pi