[nycbug-talk] crontab woes

Kevin Reiter tux
Tue Jul 19 16:48:20 EDT 2005


All,

I'm ready to pull my hair out on this one..

I have a crontab setup to run a small shell script every day at 1:15 am. 
  The script writes to a log so I can follow the activity, but I've 
noticed it's empty.  When I do some further checking to see if the 
script did what it's supposed to do, I see that it didn't run at all.

Here's the crontab entry:

root at Vulcan# crontab -l
# Run the script every night at 1:15 AM
15 1 * * * /root/scripts/myscript.sh

The script is in place, is executable, and runs just fine if I do 
./myscript.sh

cron is running:

root at Vulcan# ps wax | grep cron
   154  ??  Ss     0:06.88 /usr/sbin/cron

root at Vulcan# uname -a
FreeBSD Vulcan 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Sat Mar 13 10:13:57 
EST 2004     root at Vulcan:/usr/obj/usr/src/sys/Vulcan  i386

Any ideas?  This is something so simple, yet very exhasperating.

-Kev


Here's the contents of my script with sensitive info edited in { }:

#!/bin/sh
#
# Gets the outside IP of this machine and sends it to a secure location 
# on the Penguin Netwerx web server to be used for remote access.
# The only port that this requires is /usr/ports/ftp/ncftp3

# Define the DATE variable for logging
DATE=`date +'%m-%d-%Y %H:%M:%S'`

# Get our outside IP
fetch www.penguinnetwerx.net/ip.php

# Rename ip.php to this company
mv ip.php {company name}
IP=`cat {company}`

# Send the IP file to the server and log it
ncftpput -u {username} -p {password} {server} 
www.penguinnetwerx.net/{directory}/ {company}
echo '' >> update_ip.log
echo "$DATE IP updated successfully." >> update_ip.log
echo "My IP is $IP" >> update_ip.log

# Send the e-mail notification
echo "$DATE IP updated to $IP for {company}" > temp.email
mail -s "IP Update for {company}" spam_me at penguinnetwerx.net < temp.email


# Delete the files to avoid issues with future conections
rm {company}
rm temp.email

# Done.




More information about the talk mailing list