Sending a command line SMS.

I’m trying to send a text message from the command line to a cell phone. Right now I’m working with gnokii but it isn’t panning out. I ran

echo "This is a test message" | gnokii --sendsms +17191234567 -r

but it isn’t working. The output I get is this

GNOKII Version 0.6.27                                                                           
Couldn't read /root/.gnokiirc config file.                                                      
Couldn't read /root/.gnokiirc config file.                                                      
LOG: debug mask is 0x1                                                                          
Config read from file /etc/gnokiirc.                                                            
phone instance config:                                                                          
model = 6510                                                                                    
port = /dev/ttyS0                                                                               
connection = serial
initlength = default
serial_baudrate = 19200
serial_write_usleep = -1
handshake = software
require_dcd = 0
smsc_timeout = 10
rfcomm_channel = 0
sm_retry = 0
Connecting
Serial device: opening device /dev/ttyS0
Serial device: setting speed to 115200
Serial device: setting RTS to low and DTR to low
Getting model...
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Serial device: closing device
Serial device: opening device /dev/ttyS0
Serial device: setting speed to 115200
Serial device: setting RTS to low and DTR to high
Getting model...
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Serial device: closing device
Serial device: opening device /dev/ttyS0
Serial device: setting RTS to low and DTR to low
Serial device: setting RTS to high and DTR to high
Serial device: setting speed to 19200
Switching to FBUS mode
Serial device: setting speed to 115200
Getting model...
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Message sent: 0x1b / 0x0006
00 01 00 07 01 00                               |
SM_Block: exiting the retry loop
Serial device: closing device
Telephone interface init failed: Command timed out.
Quitting.
Command timed out.

I’m not particularly attached to gnokii, I just need to send text messages from the command line.

Thanks!

Hi
Does the service provider have email to sms connectivity? I can send to
my cellphone just via the mail command…


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.4 (x86_64) Kernel 2.6.37.6-0.5-desktop
up 1 day 3:01, 5 users, load average: 0.14, 0.10, 0.13
GPU GeForce 8600 GTS Silent - Driver Version: 270.41.06

hmm… They might, but I don’t know. What incarnation of mail do you use? Do you just replace the email address with the 10 digit phone number?

On 06/21/2011 07:06 PM, blank888 wrote:

> I’m not particularly attached to gnokii, I just need to send text
> messages from the command line.

before the Skype for linux client could do SMS i used something named
“send_sms.py” which (if i remember correctly) was a python script which
sent SMS via Skype from the command line, using a format like this:

send_sms.py [options] phone_number,phone_number,(etc)] msgText

i don’t remember where i got it, but i guess Google does :wink:

of course, i expect Skype’s new owners to close all access to us, unless
we boot their stuff…


DD
Caveat
Hardware
Software
21 June: Sunrise 4:34 AM, Sunset 10:03 PM

On 06/21/2011 08:06 PM, blank888 wrote:
>
> Do you just replace the email address with the 10 digit phone
> number?

no…
he said “service provider” or your ISP…

check with your ISP, they may have an email address you can send to
which will result in an SMS being sent to the phone you specify…

there is usually a charge for that (at least in this country)


DD
Caveat
Hardware
Software
21 June: Sunrise 4:34 AM, Sunset 10:03 PM

I just figured it out. If your sending to an AT&T customer you can just replace the email address with phone_number@txt.att.net or if your sending to a verizon customer you can send it to phone_number@vtext.com. I know the AT&T works, but I’m not sure if the Verizon does since I don’t know anyone that uses Verizon. If someone would try it out and post your results here I would really appreciate it.

On Tue, 21 Jun 2011 18:06:03 +0000, blank888 wrote:

> hmm… They might, but I don’t know. What incarnation of mail do you
> use? Do you just replace the email address with the 10 digit phone
> number?

No, you typically have an e-mail address from the mobile phone carrier
that’s set up as an e-mail address to receive SMS texts. The format
varies from carrier to carrier, just like e-mail addresses at gmail,
hotmail, or yahoo can have different address formats.

The format needs to be an e-mail address format, otherwise your mailer
won’t know how to forward it along (e-mail programs only know about e-
mail style addresses)

Jim

Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2011-06-21 19:06, blank888 wrote:
>
> I’m trying to send a text message from the command line to a cell phone.
> Right now I’m working with gnokii but it isn’t panning out. I ran

First, you have to make gnokii work standalone, no pipes. And do so as
user, not root.

There are two application for using the mobile phones, and both have
problems; one is gnokii, the other I forget. Plus, connecting via cable has
more problems than via bluetooth.

In the end, to use some functions you need windows.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I do not know if others allready pointd you to it, bbut recahing this point in the thread


GNOKII Version 0.6.27                                                                            
Couldn't read /root/.gnokiirc config file.                                                       
Couldn't read /root/.gnokiirc config file. 

I got the shivers. Are you realy running such an end-user program as root???

If you are going to be doing a lot of sending, I would recommend you subscribe to a commercial service on the Internet. They provide you with APIs. They can also do it much cheaper and faster, especially for bulk SMSes, than the retail rates you pay on your phone plan.

Well actually to make you feel better I have a couple of 11.2 boxes that are throw aways so I can do my experementing on them. If anything goes wrong I can blow them away without worry.
But yes. I was running it from a remote console and I had sued into root before running. I usually test things as root on those two **** machines before moving them into a production or personal environment. After that I use my usual login.

Of course you can do with your system what you want, but I am sensitive when people show they run things as root unneeded without explaning to the noobs, that read these threads also, that that is not an example that should be followed.

Ahh ok. I’ll be sure to do that.

On 06/23/2011 05:36 PM, blank888 wrote:
>
> I usually test things as root on those two ****
> machines before moving them into a production or personal environment.
> After that I use my usual login.

well, imo that is a bad habit…and, unnecessary…for one thing, you
might test as root and then find the production set up won’t work as a
normal user…and, then all your tests time is wasted motion…

and, what do you mean by you test as root and then go about “moving them
into a production or personal environment”, do you mean you move the
software to another machine? or you do you move the machine into the
production environment??

well, in either case, by the time you have done all your testing as root
you may be rooted already! and then move the compromised machine into
the production environment…

it is very bad practice running as root unnecessarily…you didn’t learn
that in *nix school, did you?


DD
Caveat
Hardware
Software
23 June: Sunrise 4:36 AM, Sunset 10:03 PM


Heres what happens.
I have two machines with no value what-so-ever. I abuse the hell out of them. If there is something new that I need to try, I try it on them first, usually logging in as root so I don’t have to worry about permissions. After I have a better idea of whatever new toy I have is working, I attempt it as a normal user. Then I see what new problems spring up, if any. This way I tackle a smaller set of problems at a time making each individual problem easier to work out. The machines that I abuse never leave their little hole, only my scripts/changes do.
And yes, it is necassary. Much of my job involves digging around the anals of the security settings in yast or /etc or wherever, moving in and out of protected folders. I only started learning linux

I have never typed

Removed for security reasons

as root. Nor will I ever.


Heres what happens.
I have two machines with no value what-so-ever. I abuse the hell out of them. If there is something new that I need to try, I try it on them first, usually logging in as root so I don’t have to worry about permissions. After I have a better idea of whatever new toy I have is working, I attempt it as a normal user. Then I see what new problems spring up, if any. This way I tackle a smaller set of problems at a time making each individual problem easier to work out. The machines that I abuse never leave their little hole, only my scripts/changes do.
And yes, it is necassary. Much of my job involves digging around the anals of the security settings in yast or /etc or wherever, moving in and out of protected folders.

I have never typed

Removed for security reasons

as root. Nor will I ever.

On 06/23/2011 09:06 PM, blank888 wrote:
>
> I have never typed
> [destructive and dangerous code deleted]
> as root. Nor will I ever.

you just did! but, that string is only one of thousands of reasons to
not log into the GUI as root…

but, you are correct in using whatever work procedures you wish to use
on your own machines, whether ‘approved’ by trained linux system
administrators, or not…or whether bad procedures which introduce known
security issues, or not…

i am familiar with the fact that other operating systems have different
administrative procedures and know that many of those should not be
followed in linux…

but, while you are free to try what you wish…we here are also free to
do everything possible to make sure those new folks who google into this
thread know for sure that you logging in as root into your GUI on your
machine is not something they should do (unless they enjoy being rooted
or otherwise compromised or damaged)

ok


DD
Caveat
Hardware
Software
23 June: Sunrise 4:36 AM, Sunset 10:03 PM

I did not log into GUI, I ran su from the console.
And I already agreed to warn the new folks about the dangerous power of root. That was handled by hcvv.

On 06/23/2011 10:36 PM, blank888 wrote:
>
> I did not log into GUI, I ran su from the console.

then i entirely misunderstood!


DD
Caveat
Hardware
Software
23 June: Sunrise 4:36 AM, Sunset 10:03 PM

@blank888: warning new folks is not the issue. Point is, that you developped a way of working/testing that’s completely not the way to do things. Testing user programs is done as a user, and root is not a normal user, as you know. Testing as root makes user testresults invalid, since you don’t know if testing as root has made systemwide changes (happens). And I did not even mention that you do connect to the web as root whilst testing your app. Henk’s warning is to be taken very serious. One of these days you will miss your morning coffee and forget you’re not on one of these wasteable machines and ruin a production environment completely.
I’ve been trying to train somebody who does things like this. The end of the line is that indeed one of his machines got compromised first, his other machines in the days after that, no backups, half a year of development gone when intruder wiped some partitions. No joke. Afterwards it appeared that running things as root changed some default secure settings to completely open, so no issues when running as a user, where there should have been.
End of the line: do yourself a favor and change this.