ISPsystem.com Forums

ISPsystem.com Forums (http://forum.ispsystem.com//index.php)
-   Troubleshooting (http://forum.ispsystem.com//forumdisplay.php?f=11)
-   -   Custom Operations not working (http://forum.ispsystem.com//showthread.php?t=2151)

Patrick 09-24-2013 04:21 PM

Custom Operations not working
 
Hello,
I would perform some custom operations after a domain get's created or deleted.
I followed this guide:
http://en.ispdoc.com/index.php/Perfo...tom_operations

For testing i added a /usr/local/ispmgr/etc/ispmgr_mod_jetty-add.xml:
Code:

<?xml version="1.0" encoding="UTF-8"?>
  <mgrdata>
    <handler name="jetty_add.pl" type="cgi">
      <event after="yes">domain.edit</event>
    </handler>
  </mgrdata>

And added /usr/local/ispmgr/addon/jetty_add.pl:
Code:

#!/usr/bin/perl
use CGI;
my $Q = new CGI;

    system("touch /root/jetty_added");

print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<doc/>\n";

jetty_add.pl has ben chmoded 750 and is owned by root.root

I restarted ispmgr and tried to add a domain. The domain gets created but nothing happens. No error or something, but jetty_added gets not created.

Running perl /usr/local/ispmgr/addon/jetty_add.pl creates a empty file /root/jetty_added, so the script is working. But it seems ispmgr doesn't fire it on events.

What is missing?

fly 09-25-2013 11:01 AM

Hello,

Did you restart ISPmanager? ISPmanager can be restarted via command killall ispmgr

I added your xml and script to my ISPmanager and it works properly.

Sep 25 11:58:12 [30159:11] INFO Request [188.120.252.33][root] 'name=mary.me&ip=188.120.228.130&ns=ns1.mary.me.+n s2.mary.me.&ns_list=&mx=mail+mail&mx_list=&owner=m ary&func=domain.edit&elid=mary.me&sok=ok'
Sep 25 11:58:12 [30159:11] ../../src/ispmgr/core/ispmgr.cpp:746 TRACE Rebuild AccountCache force[false] pgen[1] cgen[20]
Sep 25 11:58:12 [30159:11] ../../src/ispmgr/core/ispmgr.cpp:922 DEBUG Total accounts 2
Sep 25 11:58:12 [30159:11] ../../src/mgr/core/action.cpp:421 DEBUG Execute addon 'addon/jetty_add.pl'
Sep 25 11:58:12 [30159:11] ../../src/mgr/core/session.cpp:390 DEBUG send post data 'name=mary.me&ip=188.120.228.130&ns=ns1.mary.me.+n s2.mary.me.&ns_list=&mx=mail+mail&mx_list=&owner=m ary&func=domain.edit&elid=mary.me&sok=ok'
Sep 25 11:58:12 [30159:11] ../../src/mgr/core/action.cpp:476 DEBUG return code 0 recived result '<?xml version="1.0" encoding="UTF-8"?>

Patrick 09-25-2013 05:46 PM

I even rebooted the server (it's a testing machine), but no luck.
And no hints in the ispmgr logs :(

fly 09-26-2013 10:09 AM

Please show ISPmanager's log in time you call function domain.edit.

Patrick 09-26-2013 10:34 AM

Here the ispmgr.log:
Sep 26 09:28:09 [ 3108:229] INFO Request [192.168.1.10][root] 'operafake=456&plid=&func=wwwdomain%2Eedit'
Sep 26 09:28:09 [ 3108:229] INFO Internal Request 'wwwdomain.log' 'elid='
Sep 26 09:28:09 [ 3108:229] INFO Internal Request 'wwwdomain.log' 'out=xml&elid='
Sep 26 09:28:09 [ 3108:229] INFO Internal Request 'cert' ''
Sep 26 09:28:41 [ 3108:230] INFO Request [192.168.1.10][root] 'domain=example.org&alias=www.example.org&alias_li st=&docroot=auto&owner=patrick&ip=192.168.1.30&adm in=info%40example.org&charset=&index=&index_list=& autosubdomain=asdnone&php=phpnone&ssiext=&sslport= 443&cert=newcert&page_php_th=__nopage__&static_reg ex=dummy&static_ext=&static_ext_list=&accesslog=ro tated&errlog=rotated&rotper=day&size=&arcnum=10&an alyzer=none&analper=day&func=wwwdomain.edit&elid=& sok=ok'
Sep 26 09:28:41 [ 3108:230] EXTINFO Execute (/bin/cp -Rp /usr/local/ispmgr/etc/www.skel /var/www/patrick/data/www/example.org) return=0 exited
Sep 26 09:28:41 [ 3108:230] INFO Internal Request 'wwwdomain.log' 'elid=example.org&rotper=day&size=&analper=day&arc num=10&analyzer=none&errlog=rotated&accesslog=rota ted&sok=ok&out=xml'
Sep 26 09:28:41 [ 3108:230] INFO Internal Request 'diraccess.edit' 'sok=ok&name=/www/example.org/webstat&dirindex=index.html'
Sep 26 09:28:41 [ 3108:2] EXTINFO Execute (/etc/rc.d/init.d/nginx reload) return=0 exited
Sep 26 09:28:41 [ 3108:2] EXTINFO Nginx `/etc/rc.d/init.d/nginx reload` complete successful
Sep 26 09:28:42 [ 3108:230] INFO Internal Request 'diraccess.user.edit' 'sok=ok&name=patrick&plid=/www/example.org/webstat&hash=$1$Z5BawbJo$MPHfUsSuiGdV5lmmQAzpm.'
Sep 26 09:28:42 [ 3108:2] EXTINFO Execute (/etc/rc.d/init.d/nginx reload) return=0 exited
Sep 26 09:28:42 [ 3108:2] EXTINFO Nginx `/etc/rc.d/init.d/nginx reload` complete successful
Sep 26 09:28:42 [ 3108:3] EXTINFO Execute (/usr/sbin/apachectl graceful) return=0 exited
Sep 26 09:28:43 [ 3108:231] INFO Request [192.168.1.10][root] 'clickstat=yes&func=wwwdomain'

fly 09-26-2013 12:34 PM

I see that toy call function wwwdomain.edit , but your custom operation runs after function domain.edit.

Function wwwdomain.edit is called when www domain is creating. Function domain.edit is called when domain name (DNS) is creating.

Patrick 09-26-2013 12:49 PM

Okay, so I used wrong event. I'll give it a try. Thx.

Edit: works!


All times are GMT +2. The time now is 09:59 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.