On 10/03/2015 02:30 PM, Bo Berglund wrote:
The program will probably be started by cron every minute to check if
it has anything to do and if so execute its data collection task and
quit. Otherwise just quit, but here maybe also check for an update on
the web?
But how could one exchange a running program on the pi from within
itself?

off the top of my head:

since you're running from cron and exiting, this could be pretty simple...

1. at start up, check if self is named known temp name. if yes, copy self to normal name, spawn normal name and die.
2. at start up pull md5 checksum file from server and compare with own md5 
checksum.
3. if md5 sums are different, download new version to known temp name.
4. at end of execution, see if known temp name exists. if it does, spawn it and 
die.

maybe something like that... of course, somewhere in there you'll still do your required processing... the end of execution will wait for everything to be done before doing step 4...

one might also use a special command line parameter to tell the known temp name to copy itself over to the normal name in step 1.

--
 NOTE: No off-list assistance is given without prior approval.
       *Please keep mailing list traffic on the list* unless
       private contact is specifically requested and granted.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to