Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: bakedjake
I am new to shell scripting and this is the first time I am trying to use cron to automate a job. The script I use generates a huge log file which I wish to mail out.
My script runs fine when called from the command line but fails to zip and mail when called from cron. Below is the script I am using
export HOME PATH EDITOR
### script to generate the alarms log file goes here
#### compressing the collected report
#### mailing zipped collection report
(cat body; uuencode "$fname.gz" "$fname.zip") ¦ /bin/mailx -s "Active Alarms Collector Report" "$TO"
Please could someone tell me what I am doing wrong here? I am at my wits end as the script behaves when called from command prompt. I guess I am missing some environmental variables but which ones?
have you looked at the value of the error codes returned by the commands.
the special variable $? contains the return code of the last commmand...
Many thanks for your reply ...
On checking the mailbox I found that gzip & mailx were both failing as variable $fname didn't contain the fully qualified file-name. On fixing this the error disappeared!
Thanks again for setting me on the correct path. :-)