I have a C++ program that needs to schedule various future processes to kick off on a one-time-only basis.
The development is in Linux so the obvious choice is to use the 'at' command; I'm not interested in writing my own job scheduler!
However I'm reluctant to fork an OS process from my program to call the 'at' executable directly - as this is messy, and cumbersome.
With cron, I know you can write jobs as files out to /etc/cron.d without the need to fork to crontab. However no such facility seems to exist for 'at'.
A bit of research has lead me to the conclusion that I could simply write files to /var/spool/cron/atjobs using the formant axxxxxyyyyyyyy where x=job id and y = hex epoch time in minutes - but this hardly seems in the spirit of Linux security or convention.... plus the filename format is not portable across all *nix systems, should I wish to use another operating system.
Of course I could use cron, but it doesn't sensibly cater for one-time-only jobs, so this doesn't strike me as a good solution either. Nor do I want to grab the source for these tools and rework the necessary bits into my program - this too isn't exactly portable.
So my question is - if I want to schedule execution of future jobs at a given time and date for a single run can anyone suggest a programatically 'nice' way of either interfacing 'at' or the cron daemon directly without having to fork to the OS in C++.... or is there another standard tool that provides this?