Background: I'm running Debian on a remote server with Mathematica installed. I have several dozen small mathematica files that are run in cron jobs at unpredictable intervals and updated based on a web interface. I'm trying to get faster response times when I run the smaller files.
Question: For Example I have file.m which contains(This is just an example)
Export["/home/rob/Desktop/eq.png",Sum[1/2,{x,i}]]
If I setup a cron job to run the following
time MathKernel -noprompt -script /home/rob/Desktop/file.m
I get a real response time of 6.31.
But now if I ssh into the server and run MathKernel and the following
AbsoluteTiming[Export["/home/rob/Desktop/eq.png",HoldForm[Sum[1/2,{x,i}]]]
the script returns 1.13.
The start up time definitely appears to be the issue 6.31 vs 1.13.
So what is the best way to keep MathKernel running it the background so it can periodically run file.m?
I would like to avoid using CreateScheduledTask because of the extensive rewrite that would be needed.