inside
/etc/ppp/ip-up.d i have this script that executes automatically when the interface
ppp0 comes up.
Code:
#!/bin/sh
echo "Checking if exist internet connection"
ping -c 3 www.google.com
if [ $? -eq 0 ]; then
echo "Starting to send & download email"
echo "Flushing mail queue"
/usr/sbin/postqueue -c /etc/postfix -f
echo "Starting fetchmail"
/usr/bin/fetchmail -v -f /etc/fetchmailrc -L /var/log/fetchmail.log
echo "Checking mail queue and fetchmail process"
while ! postqueue -p | grep -q empty && ps -C fetchmail > /dev/null; do
echo "There is still mail in queue or fetchmail is still working"
sleep 1
done
echo "Terminating the connection"
killall wvdial
fi
echo "Internet connection not found"
i need to see the output for debug of this script, how can i log this to /var/log/script.log everytime it runs automatically?
Recent comments
8 hours 20 min ago
17 hours 47 min ago
18 hours 37 min ago
22 hours 10 min ago
1 day 2 hours ago
1 day 2 hours ago
1 day 5 hours ago
1 day 15 hours ago
1 day 20 hours ago
1 day 21 hours ago