Jalal When you shut-down Kannel using HTTP if you then request the status you will get a 102 error, “Connection refused”: at least that’s what I get. Though if you request status immediately after issuing the shut-down request you can see that the Bearer Box is in the process of shutting down, but you’ve probably only got a second to do that.
If you start the Bearer Box with the –d switch you can also supply the -P (capital P) switch. This starts a watcher process that will restart Kannel if it crashes. It only restarts the Bearer Box, you have to handle restarting any SMS Boxes you might have yourself. You can also supply the -X <filename> (capital X) switch to specify a script (or executable) to be run when a crash is detected. This script could handle restarting your SMS box(es). This is not something I’ve tried. I don’t know how it handles a standard shut-down request. What you describe with the -d switch: nothing showing up in the console, is what I would expect. However, when I issue the status request via HTTP I can see that my Kannel is running. How did you determine that the Bearer Box did not start? From what I can tell the web interface is integral with the Bearer Box; certainly when I start the Bearer Box without starting an SMS box I can access the web interface. And after I’ve shut-down the Bearer Box the web interface does not respond. I believe that you need to have one port for admin and a different port for sending SMS requests to Kannel. I don’t understand why your Bearer Box is restarting by itself. It sounds to me that you’ve got a Linux related issue, rather than a Kannel issue. I know very little about Linux: indeed all I know I’ve learnt this week (more or less)! Perhaps some folks on here who know more about Linux might be able to throw some more light on the matter. Richard From: Jalal Uddin [mailto:[email protected]] Sent: 09 March 2011 10:15 To: Richard Crawshaw Cc: [email protected] Subject: RE: How to stop bearerbox and smsbox Thanks a lot Richard, you gave me some info that I didn’t know before. But unfortunately the problem remains, this time I tried the web interface through url to shutdown the bearerbox / admin process. It told me “Bringing system down” and I applied this command: sudo netstat -anp|grep 12345 (12345 is the admin port for me) I can see that the bearerbox stops when I apply this, but after a while it just again comes back. I just simply don’t understand why it is auto restarting even if I kill it or stop it. I just simply applied the same command you used to start bearerbox or smsbox, just that I didn’t used the –d option. When I use –d option nothing shows up in the console but I see that the bearerbox also do not start then, so I avoided the –d. When you use –d option, can you run the bearerbox in the same port? Does admin process (the web interface) always keeps running? I have a feeling that after installing kannel this admin thing do not die ever. It always runs, (even if I stop kannel) Any idea around it? Thanks From: Richard Crawshaw [mailto:[email protected]] Sent: Wednesday, March 09, 2011 3:32 PM To: Jalal Uddin Cc: [email protected] Subject: RE: How to stop bearerbox and smsbox Jalal You can shut-down the Bearer Box using HTTP. When the Bearer Box is shut-down the SMS box shuts-down. In the core group of the config file you can set the admin-port. Use this port to control the Bearer Box. Look at “HTTP Administration” section in the User Guide; this will tell you how to do this. My core group looks like this: group = core admin-port = 4001 smsbox-port = 4002 admin-password = foobar <snip> From the computer that is running Kannel, this will retrieve the Bearer Box status: http://localhost:4001/status.html and this will shut-down the Bearer Box http://localhost:4001/shutdown?password=foobar<http://10.248.132.115:4001/shutdown?password=gateway> If you start the Bearer Box and the SMS Box with the -d (or --daemonize) switch then you won’t have the terminal window tied up running them. I’m using this: <path-to-bb>/bearerbox -v 1 -d <path-to-config>/kannel.conf followed by: <path-to-sms>/smsbox -v 1 -d <path-to-config>/kannel.conf (The -v 1 turns off debug logging.) I’ve constructed a web-page to manage the Bearer Box through HTTP. You might want to do similar. I can post this code if people would find it useful. Hope this helps. Richard From: [email protected] [mailto:[email protected]] On Behalf Of Jalal Uddin Sent: 09 March 2011 08:44 To: 'Alejandro Guerrieri' Cc: [email protected] Subject: RE: How to stop bearerbox and smsbox Thank you very much for the reply. Actually I tried to kill bearerbox many times, and now I have tried it again. I have applied the “top” command to see the running processes. And everytime I kill the bearerbox, it just comes back again with a new process id. Any idea why this can happen. It is like something is monitoring bearerbox and whenever it is dead, it re creates it. You told me to use –daemonize switch, the documentation says that it will detach the bearerbox from terminal, so I guess that will free my terminal, but will that solve this issue? It seems like something is not letting bearerbox to be dead. Btw, I have stopped kannel with the following command before killing the bearerbox, I have also killed smsbox using the killall and using kill -9 process id, and still the bearerbox is getting back, I can’t believe this. Any idea what monitors bearerbox or how to stop it so that it do not restart? Thank you. From: Alejandro Guerrieri [mailto:[email protected]] Sent: Wednesday, March 09, 2011 1:02 PM To: Jalal Uddin Cc: <[email protected]> Subject: Re: How to stop bearerbox and smsbox Use the --daemonize switch to detach from the console. To kill the processes, you can identify the process id's and kill -9 them, or do a killall by process name. Check the user guide for the finer details. Anyway, I'd recommend you to use an init script, there's some examples for RedHat/CentOS and other distros floating around, google a little bit and you'll find out. Regards, -- Alex Guerrieri On 09/03/2011, at 07:50, "Jalal Uddin" <[email protected]<mailto:[email protected]>> wrote: Hello, I am new with kannel. I usually run kannel (bearerbox , smsbox) from command prompt. Like below: Terminal 1 $> cd /etc/kannel $> Bearerbox kannel.conf Terminal 2 $> cd /etc/kannel $> Smsbox kannel.conf And everything starts up and I can send sms from the browser using url. The problem is when I start kannel like that it hangs the terminal as it continuously listens to the service. But that is not a problem. The problem is when I need to shut down the server. I need to stop those two bearerbox and smsbox. So say I apply Ctrl+z and they stop. Then I close the terminals, and restart the pc. But after that when I try to start bearerbox and smsbox, I can’t do that. It says the ports are already in use. If I restart kannel (well server restart should do that as well I guess) it still says port is in use and nothing works. So I have to open kannel.conf and change the port and then again the bearerbox and smsbox work. Interesting is I can’t use the old ports never ever. So this is a problem that every time I need to change kannel.conf or restart kannel or server. I have to apply a brand new port. I understand this is very silly and should be the case. I feel like all my previous runs are still running in the pc. But I don’t know how to stop them and can use the same port next time. I have searched hard in internet but I hardly see anyone facing such silly problem, so I wonder what I am missing. I will be very thankful if someone can point out what I am missing, like what is the perfect way to restart kannel and how can I use the previous ports again. Thank you
