bash: check for network

C. Ed Felt ed at thefelts.net
Thu Apr 14 15:41:52 MDT 2005


If you add ">> /pathToSomeLogFile" or even "> /pathToSomeLogFile" (if 
you don't want to track this) at the end of your cron command you can 
avoid those annoying emails.  This makes cron save what it normally 
emails you to a log file.

-Ed Felt

Dan Wilson wrote:

>Hey all,
>
>I've got a cron script that connects to a remote server to accomplish a
>few tasks.  I run this on my laptop and sometimes don't have a network
>connection.  If there is no connection, I just end up getting a bunch of
>emails stuck in the queue and eventually sent to me that say it couldn't
>connect to the server.
>
>So within my script, I'd like to be able to check if I have a network
>connection prior to starting my tasks.
>
>I'm sure there is an easy way to do this (without too much awk, sed and
>grepping, etc).  Any ideas?
>
>-Dan
>
>.===================================.
>| This has been a P.L.U.G. mailing. |
>|      Don't Fear the Penguin.      |
>|  IRC: #utah at irc.freenode.net   |
>`==================================='
>
>  
>



More information about the PLUG mailing list