Help requested with capturing output from gnokii after send sms

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help requested with capturing output from gnokii after send sms

Godfrey
Hello
 
I have set up a number of scripts that notify me of a range of server room potential issues.
 
Everything is working fine.
 
How ever this evening I realised that I am not keeping tabs on the number of sms's sent out. I load the phone with say 200 sms's I need to know when they about to run out.
 
I am happy to figure out a bash script to do this if needs be. However I have a problem.
 
I dont seem to have any success at capturing the output form after gnokii after send sms
 
[hidden email] ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber --report > /var/lock/smscounter/count.txt
GNOKII Version 0.6.31
Send succeeded with reference 168!
[hidden email] ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber
GNOKII Version 0.6.31
Send succeeded with reference 169!
[hidden email] ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber >> /var/lock/smscounter/count.txt
GNOKII Version 0.6.31
Send succeeded with reference 170!
 

> or >> does not capture any out put
 
as you can see here
 
[hidden email] ~ # touch /var/lock/smscounter/count.txt
[hidden email] ~ # cat /var/lock/smscounter/count.txt
[hidden email] ~ # cat /var/lock/smscounter/count.txt
[hidden email] ~ #
 
My question has a bash script been written to keep tabs on the number of sms's sent, if not is there any way of keeping a record of the number of sms's sent, or if that is not possible is there any way of capturing the output specifically this part
 
GNOKII Version 0.6.31
Send succeeded with reference 170!
 
for later processing.
 
Your assistance would be most appreciated.
 
Thank you for your time in helping me.
 
Kind regards
 
Godfrey. 

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
Reply | Threaded
Open this post in threaded view
|

Re: Help requested with capturing output from gnokii after send sms

Pawel Kot
Hi,

On Sun, Feb 8, 2015 at 9:56 PM, Godfrey <[hidden email]> wrote:
> I dont seem to have any success at capturing the output form after gnokii after send sms

Check the return code and not the output.

> root@32.164 ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber --report > /var/lock/smscounter/count.txt
> GNOKII Version 0.6.31
> Send succeeded with reference 168!
> root@32.164 ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber
> GNOKII Version 0.6.31
> Send succeeded with reference 169!
> root@32.164 ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber >> /var/lock/smscounter/count.txt
> GNOKII Version 0.6.31
> Send succeeded with reference 170!
>
> > or >> does not capture any out put
>  
> as you can see here
>  
> root@32.164 ~ # touch /var/lock/smscounter/count.txt
> root@32.164 ~ # cat /var/lock/smscounter/count.txt
> root@32.164 ~ # cat /var/lock/smscounter/count.txt
> root@32.164 ~ #

Yes, because all output is to stderr and not stdout.

> My question has a bash script been written to keep tabs on the number of sms's sent, if not is there any way of keeping a record of the number of sms's sent, or if that is not possible is there any way of capturing the output specifically this part

Just check for the return code. It it is equal to 0 increase your counter (somehow). It it is not 0, the SMS has not been sent (and you may log it some other way).

take care,
--
Pawel Kot

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
Reply | Threaded
Open this post in threaded view
|

Re: Help requested with capturing output from gnokii after send sms

Godfrey

Hello
 
This works
 
 
[hidden email] ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber 2> /var/lock/smscounter/count.txt
[hidden email] ~ # cat /var/lock/smscounter/count.txt
GNOKII Version 0.6.31
Send succeeded with reference 187!
 
Thank you for helping me
 
Regards
 
Godfrey

 
 
----- Original Message -----
Sent: Sunday, February 08, 2015 11:39 PM
Subject: Re: Help requested with capturing output from gnokii after send sms

Hi,

On Sun, Feb 8, 2015 at 9:56 PM, Godfrey <[hidden email]> wrote:
> I dont seem to have any success at capturing the output form after gnokii after send sms

Check the return code and not the output.

> [hidden email] ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber --report > /var/lock/smscounter/count.txt
> GNOKII Version 0.6.31
> Send succeeded with reference 168!
> root@32.164 ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber
> GNOKII Version 0.6.31
> Send succeeded with reference 169!
> root@32.164 ~ # echo "This is a test message" | gnokii --sendsms +27mycellnumber >> /var/lock/smscounter/count.txt
> GNOKII Version 0.6.31
> Send succeeded with reference 170!
>
> > or >> does not capture any out put
>  
> as you can see here
>  
> root@32.164 ~ # touch /var/lock/smscounter/count.txt
> root@32.164 ~ # cat /var/lock/smscounter/count.txt
> root@32.164 ~ # cat /var/lock/smscounter/count.txt
> root@32.164 ~ #

Yes, because all output is to stderr and not stdout.

> My question has a bash script been written to keep tabs on the number of sms's sent, if not is there any way of keeping a record of the number of sms's sent, or if that is not possible is there any way of capturing the output specifically this part

Just check for the return code. It it is equal to 0 increase your counter (somehow). It it is not 0, the SMS has not been sent (and you may log it some other way).

take care,
--
Pawel Kot


_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users