annoying telnet script / cron job issue

tyler.style_at_gmail.com
Date: 05/30/05


Date: 30 May 2005 09:27:29 -0700

Hullo folks! I was hoping for a little help, here.

I wrote a little script that telnets into a machine and runs another
script, and set it as a cron job. This is used to keep an SQL server
in sync with this amazingly primitive 1980s database system called
filePro. The scripts are all terrible security breaches, but since its
all on a closed network it's not really a big issue.

The problem winds up being that it sends oodles of mail to root (the
owner of the crontab). If I redirect the cron job to /dev/null. then
the script's echo commands never make it to the command line and the
script doesn't execute. Because this is running on SCO OpenServer 5,
it's not possible to change the MAILTO or MAIL environment variables
from within the crontab, either.

Does anyone have any suggestionsfor me? I could really use some
advice!

Tyler Style tyler AT kinotox DOT com

0-59 * * * * /loaders/sql_do 2>/dev/null
---------------------------------------------------------------------
#!/bin/sh
#sql_do
#
# Run any SQL scripts waiting to be executed in
# /hd1/hd1/appl/fpmerge/public/SQL/todo.

cd /hd1/hd1/appl/fpmerge/public/SQL/todo

for fs in `ls`
do
    .././sql_exec todo/${fs}
    mv ${fs} ../archive
done
---------------------------------------------------------------------
#sql_exec
(echo open 192.168.254.55
 sleep 1
 echo theusername
 sleep 1
 echo theuserpassword
 sleep 1
 echo " mysql -u theusername -pthepassword < /mnt/public/SQL/$1 >
/dev/null 2>&1"
 sleep 1
 echo exit
 ) | telnet



Relevant Pages