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

Pawel Kot <[email protected]> Sun, 8 Feb 2015 22:39:22 +0100
Newsgroups gmane.linux.drivers.gnokii
Message-ID <CAHytCw4bx+FWL9FqPgNa++wBEHkupG_EMvX1komiihnX_PNCTA@mail.gmail.com>
Hi,

On Sun, Feb 8, 2015 at 9:56 PM, Godfrey <[email protected]> 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.

> [email protected] ~ # 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!
> [email protected] ~ # echo "This is a test message" | gnokii --sendsms
+27mycellnumber
> GNOKII Version 0.6.31
> Send succeeded with reference 169!
> [email protected] ~ # 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
>
> [email protected] ~ # touch /var/lock/smscounter/count.txt
> [email protected] ~ # cat /var/lock/smscounter/count.txt
> [email protected] ~ # cat /var/lock/smscounter/count.txt
> [email protected] ~ #

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
[email protected]
https://lists.nongnu.org/mailman/listinfo/gnokii-users