Find the answer to your Linux question:
Results 1 to 2 of 2
I created this script to monitor for ppp0 in ifconfig response. When I NOHUP 'd it (modmCk) in the script which starts ppp-go it worked well until the alarm went ...
  1. #1
    Linux User
    Join Date
    Mar 2008
    Posts
    287

    Modem monitor

    I created this script to monitor for ppp0 in ifconfig response. When I NOHUP 'd it (modmCk) in the script which starts ppp-go it worked well until the alarm went off. I could not KILL the modmCK. I ended up rebooting.
    Can someone suggest how I can start modmCK from the one I am using to start ppp-go (Slackware) and be able to leave the startup script while leaving this script running AND be able to kill it?

    while :
    do
    sleep $1s
    ifconfig | egrep -q ppp0
    if [ "$?" == "1" ]
    then while :
    do
    play /opt/SECURE/KISMET/kismet-2010-01-R1/wav/gpslost.wav 2>/dev/null
    sleep 2s
    done
    fi
    done

  2. #2
    Linux User
    Join Date
    Mar 2008
    Posts
    287

    Modem monitor

    There is a typo following sleep and before 1s which was the problem.
    For antiquated dialup users this may help:
    Code:
    ########################################################################
    # mdmCkr.sh   Will alert user when modem linkage fails by sounding
    #             4 warning bells 4 times.  
    #             If run: nohup ./mdmCkr.sh & 
    #             The nohup.out file is deleted then this script is killed.
    ########################################################################
    
    echo -e "Modem Checker Active (Job: $$)"
    knt=0
    while :
    do
       sleep 5s
    # Look for point-to-point feature (ppp0)
       /sbin/ifconfig | egrep -q ppp0
       if [ "$?" == "1" ]
       then for i in 1 2 3 4
            do
    # Play warning 4 bells if pt-2-pt is lost
               play /opt/SECURE/KISMET/kismet-2010-01-R1/wav/gpslost.wav \
                    2>/dev/null
               sleep 2s          # Bell separation time
            done
    # Display job number with each warning
            echo -e "Modem Link Failed (Job: $$)"
            knt=`expr $knt + 1`
       fi
    
    # After 4 warnings (16 bells) quit
       if [ $knt -gt 3 ]
       then rm -f nohup.out      # Remove nohup.out if run from background
            kill $$              # Kills itself if run in background
            exit
       fi
    done
    Last edited by clickit; 06-08-2011 at 03:10 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...