linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ag. System Administrator" <mag@gambling.org>
To: linux-admin@vger.kernel.org
Subject: Re: SMS as server infos
Date: Tue, 27 Jul 2004 11:24:19 +0300	[thread overview]
Message-ID: <41061133.90304@gambling.org> (raw)
In-Reply-To: <200406231841.05090.fluca1978@virgilio.it>

Luca Ferrari wrote:
> Hi,
> did anybody configured a kind of software for getting information about the 
> server status (raid, disk space, etc.) thru SMS on a mobile phone? If so, 
> could you tell me which software have you used and how you configured it (or 
> where I can find some information)?
> 
> Thanks,
> Luca
> 

Hi,

I hope this reply is not too late... But anyway, here is the solution.
(all this is short description, but anyway you have to use /dev/brain ;)

Components:

1 Nokia's DLR-3P Cable
1 Nokia 6110i Cell Phone
1 PC with serial port + Linux


Instructions:

Connect everything as needed, and go to: www.mwiacek.com
Download latest gammu from there, compile and install.

Read gammu's docs on how to setup it with --smsd option

Install Nagios (if you want) or make any other simple monitoring script.

Create cgi like this (it's simple and possible buggy - but does his work):


----------------------------
#!/usr/local/bin/perl -w

use CGI;

sub clear_it($) {
         my $var = shift;
         if ($var =~ /[^0-9\+]/g) {
                 print "<SCRIPT LANGUAGE=\"javascript\">alert('Illegal number entered!'); history.back();</script>";
         } else {
         	return $var;
         }
}

$q = new CGI;

my $to = $q->param('to');
my $msg = $q->param('msg');
my $val = $q->param('validity');

print $q->header(-type  =>  'text/html',
                    -cost  =>  'Three smackers',
                    -annoyance_level => 'high',
                    -complaints_to   => 'some@email.domain.com',
                    -destination     => "$to");


$to = &clear_it($to);


# SET THESE TO REFLECT YOUR PATHS

$inbox = "/var/spool/sms/inbox";
$outbox = "/var/spool/sms/outbox";
$sent = "/var/spool/sms/sent";
$error = "/var/spool/sms/error";

$tmp = "/tmp/OUTA_\+".$to."_$$.txt";

print $q->start_html('Simple Script');
print $q->hr; print "Got: $to $msg $val -> $tmp"; print $q->br; print $q->hr;
print $q->end_html;


if (! -z $msg) {
open (MESS, ">$tmp") || die("Can\'t open $tmp: $?");
print MESS "$msg";
close MESS;
`mv $tmp $outbox`;
}
--------------------

put it in cgi-bin dir on SAME PC where gammu installed and running.

then...

try this from linux cmd line:

/usr/bin/curl -s -S SMS_SCRIPT_URL -d "to=<your_cell_number>&msg=message_you_want_to_send&validity=max"

or

just create file with content you want to send in /var/spool/sms/outbox in form of:

OUTA_+COUNTRYCELLPHONENUMBER_PRIORITY.txt

( Example: echo "Hehe, it worked" > /var/spool/sms/outbox/OUTA_+97254xxxxxx_01.txt )

and it will be sent asap.

Wait for your sms to arrive ;)


Hope that helps.

Best Regards,
ASA


      parent reply	other threads:[~2004-07-27  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-23 16:41 SMS as server infos Luca Ferrari
2004-06-23 17:12 ` Chris DiTrani
2004-06-24 11:15   ` joy
2004-06-24 12:56     ` Ahsan Ali
2004-06-24 13:30       ` Chris DiTrani
2004-06-25 12:35         ` joy
2004-06-24  4:58 ` Andreas Unterkircher
2004-07-27  8:24 ` Ag. System Administrator [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41061133.90304@gambling.org \
    --to=mag@gambling.org \
    --cc=linux-admin@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).