Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2002-07-25
4
Medium Priority
?
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 6

Accepted Solution

by:
bira earned 1600 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 21

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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.
Suggested Courses

610 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