#!/bin/bash # licence GPLv2 ; this scripts designed by IZAMUKARERA 2011.3.31 update 2022.3.1 # ping watch of mail for rasberry pi PING_HOST=$1 MAIL_ADDRES=$2 DO_ACT=$3 CMD=/www/remote-hand/tmp/"$1"_mail.pepocmd PING_LOCK=/www/remote-hand/tmp/"$PING_HOST"_mail.lock PING_LOG=/www/remote-hand/tmp/"$PING_HOST"_mail.log PING_MSG=/www/remote-hand/tmp/"$PING_HOST"_mail.msg #WGETMAIL=/pepolinux/wget_mail.sh WGETMAIL=/usr/local/bin/peposendmail if [ $# != 2 ]; then echo usage: $0 ip_addres mail_address exit fi if ! ping -c 1 $1 2>&1 >$PING_LOG; then /usr/local/bin/msleep 1000 if ! ping -c 1 $1 2>&1 >> $PING_LOG; then date +"%Y/%m/%d %T" >> $PING_LOG if [ ! -f $PING_LOCK ]; then cat >$PING_MSG<>$PING_MSG echo '.' >>$PING_MSG cat >$CMD<$PING_MSG<>$PING_MSG echo '.' >>$PING_MSG cat >$CMD<