First thoughts on implementing the Task Scheduler
After the initial query to the Samba ml, I did some more research about how the task schedule actually works. It's actually much different than I expected. I guess since the scheduler icon was controlled by winreg queries, I thought the jobs would be stored in the registry as well. The registry paths are used to detect the presence of the task scheduling agent on the remote host. The actual jobs are simply stored as files.
So I think this might map onto cron directories pretty well. For example, it I run a job as jerry, then the job script would be stored in ~jerry/cron and a crontab entry would be made in /var/spool/cron/jerry. The interface with crontab needs a little more thought. The other detail is to figure out the file format used to present the job properties dialog to Windows. This is probably already decoded somewhere (similar to *lnk files or something).
Jonathan Johnson sent me some more information:
"FYI/FWIW, on my Windows XP machine, the jobs in the local task scheduler are binary files located in the hidden folder %SYSTEMROOT%\Tasks\ with a filename extension of .job.
This folder is one of those "special" folders that Windows Explorer displays differently. You can't copy files into or out of this folder using Explorer, nor can you view any files other than .job files. To copy into, out of, or list the contents of this folder, you're pretty much stuck with a command shell.
To display the properties of a scheduled task, the library mstask.dll is used. Some of the relevant registry keys (an incomplete list) used are:
HKEY_CLASSES_ROOT\.job
HKEY_CLASSES_ROOT\JobObject (Note, there are several other similarly named keys)
HKEY_CLASSES_ROOT\CLSID\{148BD520-A2AB-11CE-B11F-00AA00530503}
HKEY_CLASSES_ROOT\CLSID\{148BD52A-A2AB-11CE-B11F-00AA00530503}
Also, you may find the command line interface to the task scheduler, schtasks.exe, useful. Documentation can be found here."
jerry
posted at: 10:27 | path: /samba3/tasksched | permanent link to this entry