The Login Items prefpane can open a list of files when a user logs in to the Aqua console, but as far as I know there is no Aqua equivalent of anacron: a task scheduler that opens a list of items once a day, week, or month, if the user runs an Aqua session any time during that period. For example, suppose you want to back up a PGP disk exactly once a day, every day you use the machine. The disk image is only mounted when you're logged in at the console as the Aqua user. You could set up an anacron job to do this, but if another user sometimes boots the machine, the backup may not run every day. If you include the job in your Login Items, it may run more than once a day.

To overcome this problem I wrote a script I call aquacron. It's called once an hour from the root crontab. The script checks to see who, if anyone, is running Aqua. If that user has a directory ~/Library/Periodic, aquacron looks for an anacrontab at ~/.aquacrontab; if this file does not exist, a default copy is created. Then, and only then, aquacron calls anacron to run this anacrontab. By default, .aquacrontab contains three jobs, with job-identifiers unique to the user, to open (with user, not root, privileges) all the items at the root level of ~/Library/Periodic/<basedir>, for <basedir> in Daily, Weekly, Monthly, with the respective periodicities. The timestamps corresponding to these job-identifiers are updated only when the user is logged in, so they will accurately reflect when the Periodic items are due to be opened. All a user has to do to start this process is create a Periodic directory in his home Library.

I've found this script useful for automating tasks that use encryption. I have an rsync remote backup script that uses ssh as the transport method. When I log in locally, my private SSH key is decrypted and loaded into an ssh-agent by the sshLogin prefpane, which also saves the environment variables SSH_ASKPASS and SSH_AGENT_PID in ~/.MacOSX/environment.plist . They're then accessible to any LaunchServices process, but not to a shell script that I don't launch directly. I was having a hard time figuring out how to get my backup script to read these values, but then I remembered why I was using a Mac, not a Linux box. So I added '.command' to the name of the script and dropped it in ~/Library/Periodic/Daily. Now it does just what I want, and I only have to type my SSH passphrase once per session.

If anyone requests it I'll post the aquacron script.

PGP public key data

user id                 Linc Davis
key id                          0xFA0D30AD
key type                        DH/DSS
key size                        2048
key fingerprint D625 5F4F 4884 144D BCA5  4522 4F65 04BF FA0D 30AD



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Fink-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-users

Reply via email to