Solved

How to test if a modem is on/off inside a script?

Posted on 2002-07-25
4
266 Views
Last Modified: 2010-04-21
Hi,
I need to test inside a shell script (UX10.20) is a modem is on/off. If it is off, I have to do some actions (Send an email...).
That script will b excuted via cron, every minute.
1. What is the command to check the modem on/off? (Is it cu -l /dev/... ? )
    How do I do it inside a script??
2. If u can, provide me the full script. It has to do a very simple action:
   Check if the modem is active (On electricity...), if not send an email to some people.
   
Many thanks, leee
0
Comment
Question by:leeee
4 Comments
 
LVL 6

Accepted Solution

by:
bira earned 400 total points
ID: 7177692
Hi
  Suppose your modem is identified by tty1.

    Run the script below:

test=`cu -l /dev/tty1 2>/dev/null`
if [ $? = 0 ] ; then
     echo "Contact with the modem OK."
      else
     echo "Contact failed."
    # at this point place the send mail command...
fi
0
 
LVL 1

Expert Comment

by:dkloes
ID: 7198184
bira:

I don't have a system handy at the moment to see if cu has any standard output.  If so, maybe:

test=`cu -l /dev/tty1 > /dev/null 2>&1`

If not, ignore my comment.
0
 
LVL 20

Expert Comment

by:tfewster
ID: 7921687
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- Answered by bira

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7967253
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now