Hello,
Having and issue with a job scheduled in cron. The script:
#!/bin/bash
2
3 # Example shell script which can be added to roots cron job to check the
4 # Embedded Satellite disk space usage. If any table is over 90% usage, send
5 # a notice to the default email address configured within the Satellite.
6
7 #
8 # This script is supplied as a working example and is not supported by Red Hat
9 #
10
11 # Example cron entry:
12 # 1 */6 * * * /root/check-oracle-space-usage.sh
13
14 PATH=/usr/bin:/bin
15 export PATH
16
17 reportusage() {
18 /sbin/runuser - oracle -c "db-control report"
19 }
20
21 mailitout() {
22 #get Satellite email address
23 MAILADDRESS=`grep "traceback_mail" /etc/rhn/rhn.conf | awk '{print $3}'`
24
25 SUBJECT="Warning - high tablespace usage on Satellite oracle DB"
26
27 BODY="This is a notice to let you know that you have gone over 90% usage in
28 one of the Oracle Tablespaces. We recommend to be proactive and increase the
29 size of the tablespace before getting to 100% usage. Please consult
30 the Satellite documentation on using db-control to increase the size or
31 contact Red Hat Support for assistance."
32
33 ( echo $BODY; echo ; reportusage ) | mail -s "$SUBJECT" $MAILADDRESS
34 exit 0
35 }
36 #grab the usage numbers from the db-control report output
37 NUMBERS=`reportusage | awk '{print $5}'|sed '1d'| sed 's/%//g'`
38 # run db-control and then use awk and sed to get the % numbers
39 for num in $NUMBERS
40 do
41 # if number is over 90% then send warning email
42 if [ $num -gt 90 ]
43 then mailitout
44 fi
45 done
46 exit 0
Running this out of /etc/cron.daily and getting this error:
stty: standard input: Inappropriate ioctl for device
I suspect this is due to something not being re-directed to /dev/null.
Any ideas?
Thanks,
mgb