Notes about Location-Aware Cron ------------------------------- Location aware commands are documented in the xcrontab(1) man page (search for the m option and @location). INSTALLING LCRON ---------------- 1. Build xcron normally (see README for details). Configure it with the "x" naming scheme (note that, for me, batch support doesn't build) and to be installed with a the cron library in /usr/local/lib/xcron/lib cron spool directory /usr/local/lib/xcron/spool batch spool directory /usr/local/lib/xcron/spool/batch putting the binaries in /usr/local/lib/xcron/bin and cron itself in /usr/local/lib/xcron/sbin 2. Install it with "make install". 3. Install the generic parts of lcron things with "make install.lcron". 4. Patch Lcron into RedHat 6.0: make install.lcron.redhat This will make xcron start on boot and patch it into apmd (redhat 6.1 or later) and the network (redhat 6.0 or later). 5. Start xcron with /etc/rc.d/init.d/xcron start 6. Set up lcron for your local system (see "USING LCRON" below). Xcron needs to know when you get somewhere. In RedHat 6 this happens automatically through ifup/ifdown with the program "location_monitor". If that doesn't work for you (you use an earlier version of RedHat, or you don't use ifup/ifdown), then you should invoke location_monitor after you move, or run it periodically (from cron). Lcron makes location determinations by detecting changes in your attached network interfaces. (In the long run other things are planed, but for now that's all there is.) For lcron to be useful your computer must change the list of attached network interfaces when you add/remove your network pccard. USING LCRON ----------- For simple things you can use standard crontab format entries, with an @location field following the day-of-week column. Initially LOCATION is specified as IP address of your gateway. Thus, a simple lcron entry would be 0,30 * * * * @128.125.187.254 fetchmail darkstar.isi.edu which says every 30 minutes when I'm at the the place with gateway 128.125.187.254 (USC), get my mail from ISI. You can find the gateway you use with the command "netstat -rn". Of course, remembering the IP address of the gateway is a pain. You can map these numbers of names using the table in /usr/local/lib/xcron/lib/netstat_mapping. Here's mine: 128.9.160.7 isi 128.9.128.3 isi-netwave 128.125.187.254 usc 128.9.97.33 home 128.9.32.13 ppp Kuenning's xcron (upon which lcron is built) also supports a non-standard (but easier) syntax for specifying things. See the man page for crontab for the definition. For example, - :0,30 @isi rdist -f office.distfile says to run rdist every 30 minutes to replicate my files in a Kuenning-style entry. In addition to period jobs which are dependent on location, lcron also supports edge-triggered jobs which run only when you first connect to a new location. An example: m @isi /usr/local/lib/lcron/sbin/printcap_set_default ps11d_d m @usc /usr/local/lib/lcron/sbin/printcap_set_default sal224 The m says this job runs when you (m)ove (i.e., is edge triggered), @isi says where, and the rest runs a program which sets the printcap entry named default to point to the printer ps11d_d, while the second one sets the default printer to be sal224 when I'm at USC. (A digression on printcap_set_default: It copies an existing printcap entry over the one named "default". Thus you can set the PRINTER environment variable to "default" which will then be bound to whatever local printer you want. To use it, manually create a printcap entry named default (the contents of the entry don't matter), and create entries for your other printers (ps11d_d and sal224 in my case), then run printcap_set_default as above.) Sometimes you want to run jobs every so many hours when you're at a place. For example, I back up my computer every 12 hours when I'm at home. Ideally, a backup should run shortly after I get home, then periodically when I've been home a while. Here's how I do it: - :0,30 @home /usr/local/lib/lcron/bin/run_every 12h rdist home_file Sometimes you want to do a one-shot job when something happens (like you're connected to the network). Just use a location-specific at-job: xat @home < 9-Jul-99