US: 1-941-4621-069
  
Cyprus: 3-572-2052-781

Go Back   ISPsystem.com Forums > ISPmanager > General technical discussion


Reply
 
Thread Tools
Old 02-23-2013, 10:54 PM   #1
Junior Member
 
Join Date: Feb 2013
Posts: 2
Niclas Hedam is on a distinguished road
Question Running command on user.edit and user.create

Hi

I've created a hook running on change or creation of user.
My XML looks like this, /usr/local/ispmgr/etc/ispmgr_newrelic.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
  <mgrdata>
    <handler name="newrelic.pl" type="cgi">
      <event after="yes">user.edit</event>
      <event after="yes">user.create</event>
     </handler>
  </mgrdata>
My perl looks like this, /usr/local/ispmgr/addon/newrelic.pl
Code:
#!/usr/bin/perl
use CGI;
my $Q = new CGI;
$note = $Q->param("note");
 
if ($note ne "!new_relic") {
    # a user is created or changed 
    $name = $Q->param("name");
    open(FH,">","/var/www/$name/.htaccess") or die "$!";
    print FH "<IfModule mod_php5.c>\n";
    print FH "    php_value newrelic.appname $name\n";
    print FH "</IfModule>\n";
    close FH;	
}
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>OK-RELIC\n<doc/>\n";
This should create or edit the a file located in /var/www/__THE CHANGED USER__/.htaccess and write a code making new relic able to track the user.



.. but it doesn't.
I can run the file myself with success, but when it comes to ISPManager, I think it isn't even running it.

What is wrong with this??

Greetings,
Niclas Hedam
Server Administrator

Last edited by Niclas Hedam; 02-23-2013 at 10:58 PM. Reason: grammar
Niclas Hedam is offline   Reply With Quote
Old 02-23-2013, 11:03 PM   #2
Junior Member
 
Join Date: Feb 2013
Posts: 2
Niclas Hedam is on a distinguished road
Default

Typical.

Right after creating this, I seem to find out that the file is required to start with ispmgr_mod
Niclas Hedam is offline   Reply With Quote
Old 02-25-2013, 03:36 AM   #3
Support team
 
Join Date: Nov 2011
Posts: 77
Dasha is on a distinguished road
Default

Hello,

Yes, you are right.
You can read more in our documentation
http://en.ispdoc.com/index.php/Writing_plug-ins
Dasha is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:34 AM.