Federico Govoni
Federico Govoni

Reputation: 23

Gammu: run on receive exit status 1

I'm trying to use gammu and gammu-smsd to send and receive sms with my raspberry pi using a Huawei intrnet key. My problem is that when I send an sms from my phone to raspberry pi, it read the sms, it try to start the program linked at RunOnReceive = in /etc/gammu-smsdrcn file but then, it says: Process failed with exit status 1. I tried any kind of solution but I'm not capable to solve this problem by my self; I've set each permission on the script. Can someone help me? Thank you a lot.

Upvotes: 2

Views: 3650

Answers (2)

user6058194
user6058194

Reputation: 1

I was getting the same error on Raspberry Pi in combination with Huawei E3131 (Process failed with exit status 1) but I solved it.

  1. make sure you have file permissions set well. Gammu runs deamon under "gammu" user by default. So you can change it (/etc/init.d/gammu-smsd) to user who is already located in your system and has rights for executing the script. Or change script permissions by following: chmod 755 script.sh. It means you give execute rights to other users too. In fact there is additional option. Run gammu deamon with parameter -U username. Unfortunatelly it did not work for me when I used root user. PS: I would recommend to not to place the script inside /etc directory. Use /home directory instead.

  2. turn on debuging in /etc/gammu-smsdrc. Use parameters: logformat and debuglevel in section smsd. Default log is located in /var/log/syslog. May be it helps you deeply localize the problem.

  3. And the best at the end... I found that gammu returns the error even if it runs the script well! You have to write exit code inside you bash script. If you do not specify an exit code, gammu represents it as error 1. Add exit 0 in case of success in the end of the script and error message disappears.

Upvotes: 0

Ian Boag
Ian Boag

Reputation: 3102

You no doubt have this sorted by now, but I have just been through the same trip, tore out a lot of hair and finally made it out the back .... :-)

I'm using a ZTE stick with wvdial for internet connection. The stick appears as modems on /dev/USBtty0, 1 and 2. wvdial uses USBtty2, so gammu (I think) has to use a different one.

So I installed gammu/gammu-smsd on USBtty1 in gammu-config and /etc/gammu-smsdrc. The receive daemon gammu-smsd fires up automatically on boot.

First trap for young players - if you want to send an SMS with echo "whatever" | gammu sendsms TEXT xxxyyyzzzz (where the last is the phone no) - you need to kill the receive daemon for that to work ie

 service gammu-smsd stop     # kill receive daemon
 echo etc etc gammu etc etc  # send the SMS
 service gammu-smsd start    # revive the receive daemon

Now for the RunOnReceive thing ...

start with sudovi - gives some config file to edit. There's a line in there about pi BLAH-BLAH-BLAH as a sudoer. Duplicate it with gammu BLAH-BLAH-BLAH. Same BLAHs. Save it.

It's something to do with permissions - I'm not an expert here :-)

So my RunOnReceive line is { sudo /home/pi/procSMS.sh $SMS_1_TEXT }

The script didn't seem to know what $SMS_1_TEXT was, so I passed it through as a parameter - inside the script it's treated as $1. It works.

While testing I ran a process in another window - just tail -f /var/log/syslog which lets you watch it all in real time ...

Upvotes: 3

Related Questions