New DA service shows as stopped (when it isn't)

BYGino

Verified User
Joined
Apr 20, 2007
Messages
24
Hi All,

I've just finished installing Secure Trading's Xpay4 java program as a service in the init.d folder. I can start and get the status etc as expected by
Code:
Service xpay4 start|stop|restart|status
So I added
Code:
xpay4=ON
to
Code:
/usr/local/directadmin/data/admin/services.status
and added xpay4 to chkconfig but it isn't showing the processes in DA it always shows the service as "stopped even though the shell says otherwise.

The buttons work fine, I can start and stop the process and when I check the service via the command line, it's accurate but it continues to show as stopped.

Have I missed something?

It's nothing urgent really as I can still start/stop from the command line but I'd just like to know if I need to do anything else.

EDIT: Although it isn't urgent, I keep getting an email to say it's down so I'll need to turn off monitoring until I can get to the bottom of this.
 
Last edited:
Has anyone any ideas?

The start/stop/restart buttons in DA Service Monitor DA actually work it's just that the status isn't correct. If I check the status from the command line it is showing correctly i.e:
Code:
/sbin/service xpay4 status
xpay4 (pid  15292) is running...
but in DA Service Monitor is showing as "Process is stopped" and if I have monitoring on it emails me every hour to say the service is down.

I'm a bit of a newB so I could have missed something simple.
 
Just a hunch, but does that create a /var/run/xpay4.pid file with the actual pid? DirectAdmin may be not be finding the pid file and that is why it thinks it is down.
 
Just a hunch, but does that create a /var/run/xpay4.pid file with the actual pid? DirectAdmin may be not be finding the pid file and that is why it thinks it is down.

Good hunch! Yes it does create a xpay4.pid - any idea how I'd get DA to recognise this?
 
OK, I've done a little more digging and I believe DA uses the contents of /proc to determine if a service is running or not.

When I do a "ps" the process is actually showing as "java" against the pid which is correct as xpay4 is a java script.

Is it still possible to monitor xpay4 using this method?
 
It's quite and old thread I suppose so it could have changed but I was going with this thread...

Hello,

DirectAdmin uses the output from /proc to see what programs are running. The name of the running program is what matters.

you can change the name's of the programs DA checks by editing:
/usr/local/directadmin/data/admin/services.status

but for restarts, etc DA will still be calling "httpd", so you'd have to link the boot script.

John
Is john still about? If you are, any chance you could elaborate a little on how you get the status information. Or even point me in the right direction of where all the magic happens and perhaps I can work it out for myself. I'm just not sure where to start looking.
 
Yeh, I had a good look through them before but there's nothing to say how it actually works.

This one is the old method and this is the new method. Does the new method work the same way as the old script? If it does, I don't get it. When I run the commands myself, I can see that the process is running but DA still doesn't pick it up.
 
Last edited:
Hello,

You must use the same name as the process that will be running.
The boot script must also match this process name.

If the process shows "java" instead of "xpay4", then DA won't see it.
Your options would be to either create a fake script that does nothing and runs in the background, called xpay4.. or else change your boot scripts to be named "java".. including the value in the services.status.

Option 3 would be to set:
xpay4=OFF

so DA doesn't check for it, but you can still see that it's there.

John
 
Thanks John,

I current have xpay4=off which is fine but it would be nice to get the notifications from directadmin so I'll try changing the boot script names and see how that goes.
 
Sorry to resurrect an old thread but my script went down and I wasn't notified.

Your options would be to either create a fake script that does nothing and runs in the background, called xpay4.
How would you suggest I go about doing this john? I could integrate into my script a method of starting and stopping this process whenever the xay4 process is started/stopped but I'm not really sure how I would run a script that doesn't do anything in the background.
 
Why not just write a shell script to check it . Its not that hard.
 
I suppose I could, I just like things to be nicely integrated and I like the way I can start/stop/restart/status all from directadmin.

I guess I can just do a status check every 5 mins or so and email myself if it goes down.

Would love to get this integrated though, but I don't think it's going to happen.
 
Last edited:
John already told you the limitations of the DirectAdmin monitor and has given you some ways to get around them. If your program can't match those limitations, and you can't do as John suggests, then you'll need to monitor it yourself. You could certainly create a script for restarting it which you could run from a plugin you could create.

Unless there are lots of people running Xpay4 on DirectAdmin (and from the posts to this thread it doesn't look as if there are), I doubt a special monitor for it is going to be written by DirectAdmin publisher.

Jeff
 
Hi jeff,

I was in no way implying that anyone should write a special monitor. I was just using the forum the way forums are designed to be used and putting some feelers out to see if anyone has either came across this situation before or has any insights on how it could be done before I go blindly into trying it out for myself. I don't specifically mean Xpay4 - I just mean monitoring java scripts ran as a service.

I understand what John has said and I'm extremely grateful to him for taking the time to reply and explain how the system works but there are always ways to do things, I just have to work out what is the best way, hence the reason why I asked in the "Technical Discussion" section to get other peoples ideas and thoughts on it.

If no one has any ideas or suggestions then I'll continue to pursue it myself and if I can't figure out a solution then I'll have to give up but if I do, I'll pop back over and explain how to do it so that the next person that has the same issue will be able to learn from my experiences.
 
Last edited:
I'm sorry if my post above appears a bit unfriendly to you; frankly, it does to me on rereading this morning. I do hope you can figure something out and so help the rest of the community, and I look forward to your post.

Jeff
 
That's OK Jeff, If I'm honest I was not sure how to take your comment. I know how often things get picked up wrong since judging the tone of the typed word is difficult. I thought perhaps I was just reading it the wrong way.

Either way, no harm done. I know how active you are on this forum and just reading through some of your previous posts has helped me immensely over the past years as a directadmin user.

Anyway, I'll keep working on it. It's not tremendously important at the minute but when I have some free time, I'll do some more research and post back my results.

Bear in mind though I am a self proclaimed newB when it comes to these thing so I may have more questions, but we've all got to start somewhere, right?
 
Back
Top