Hello people, I am creating a script that will alert me in an ftp or telnet account on my system expires. FTP part is ok, but when I am entering the 3 script, it stucks. I can see that the script will not close the telnet seession. Can you please check and let me know what I am doing wrong? What if I send a CTRL-C in the script, will it work for the telnet sessin?
!/bin/sh
bill=bill@gmail.com
LOGS=/home/bill/scripts_logs
SCRIPTS=/home/bill/scripts
${SCRIPTS}/bill_ftp_check.sh > ${LOGS}/bill_ftp_check.log 2>&1
${SCRIPTS}/bill2_ftp_check.sh > ${LOGS}/bill2_ftp_check.log 2>&1
${SCRIPTS}/bill3_check.sh > ${LOGS}/bill3_check.log 2>&1
${SCRIPTS}/bill_check.sh > ${LOGS}/bill4.log 2>&1
grep failed ${LOGS}/bill_ftp_check.log
if [ $? -eq 0 ]
then
mailx -s "bill_ftp account expired" $bill < ${LOGS}/bill_ftp_check.log
fi
grep failed ${LOGS}/bill2_ftp_check.log
if [ $? -eq 0 ]
then
mailx -s "bill2_ftp account expired" $bill < ${LOGS}/bill2_ftp_check.log
fi
grep "Your password will expire" ${LOGS}/bill3_check.log
if [ $? -eq 0 ]
then
mailx -s "bill3 account is about to expire" $bill < ${LOGS}/bill3_check.log
fi
grep "Your password will expire" ${LOGS}/bill4_check.log
if [ $? -eq 0 ]
then
mailx -s "bill4 account is about to expire" $bill < ${LOGS}/bill4_check.log
fi
sleep 5
rm ${LOGS}/bill_ftp_check.log
rm ${LOGS}/bill2_ftp_check.log
rm ${LOGS}/bill2_check.log
rm ${LOGS}/bill4_check.log
exit
WHERE bill3_check.sh
#!/bin/sh
(echo open 10.0.0.10
sleep 2
echo bill3
sleep 2
echo billpass
sleep 2
echo close) | telnet
exit
Thank you in advance !
---------- Post updated at 04:57 PM ---------- Previous update was at 12:08 PM ----------
Anyone ?