I'm running a python script on my VPS every day with cron. It only has 768mb ram, and when I run the script manually I often get memory errors from python. However, I usually can just try a couple more times and it works.
Obviously, cron only runs it once, and this means that most days the task doesn't happen. Is there a way to monitor python's output and tell cron to keep running until it runs without errors?
Obviously i would put a limit of say 5 runs on, so it doesn't go forever and crash my server.
Additionally, are there some command line Linux tools to free up memory before it runs, to increase chances of it working? I'm running Ubuntu Server 11.04