On 23 Nov, 2005, at 16:07, Mac Daddy wrote: > This thing is, this script NEVER fails when run by hand! Only when > run in cron. > I have the script set to run in #!/bin/csh because this 'foreach' > loop structure above fails if I run it under /bin/sh or /bin/bash > and the code was given to me by someone else who uses csh on Solaris. This is a common problem for folks new to "multi-lingual" scripting and cron. Jobs run from cron have no meaningful environment. They actually have the very basic, default, root environment but the primary thing which is missing is a "full" $PATH. The default root environment is different from the default user environment. That means that unless you either specify the full path of a command, the command will not be found. If you throw some diagnostic (display) commands into the script, and write std-err to a disk file, you will quickly discover just what is "not found." (Put the line "set -xv" in the csh script to turn on printing and expansion. (Use something like: # test periodic stuff # 32 17 * * * root periodic daily > /var/log/periodic.out1 2>&1 to capture the output of the script in the file "/var/log periodic.out1" 2>&1 writes both standard error and standard out into standard out. The other thing which trips up folks writing for cron for the first time, is WHERE your script is executing from. Everyone always assumes that it is executing "where they want it to execute." But in reality, it executes as root from root's home directory (which is not /). There are several ways to solve your problem. "man 5 crontab" will give you most of the techniques. T.T.F.N. William H. Magill # Beige G3 [Rev A motherboard - 300 MHz 768 Meg] OS X 10.2.8 # Flat-panel iMac (2.1) [800MHz - Super Drive - 768 Meg] OS X 10.4.1 # PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg] Tru64 5.1a # XP1000 [Alpha 21264-3 (EV6) - 256 meg] FreeBSD 5.3 # XP1000 [Alpha 21264-A (EV 6.7) - 384 meg] FreeBSD 5.3 magill at mcgillsociety.org magill at acm.org magill at mac.com whmagill at gmail.com