Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Custom actions from service monitor?

Discussion in 'cPanel Developers' started by thomassmart, Nov 4, 2011.

  1. thomassmart

    thomassmart Registered

    Joined:
    Nov 4, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Is it possible to attach custom actions to the service monitor?
    For example, if apache goes down i would like to execute a specific .sh script.
    cheers
     
  2. Eric

    Eric Administrator
    Staff Member

    Joined:
    Nov 25, 2007
    Messages:
    751
    Likes Received:
    11
    Trophy Points:
    143
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Howdy,

    Sure you can. The easiest way would be to change an existing script. In my example I will show exim.

    Code:
    grimlock chkserv.d # cat exim
    service[exim]=25,QUIT,220,/etc/rc.d/init.d/exim stop;/etc/rc.d/init.d/exim stop;/etc/rc.d/init.d/exim stop;/etc/rc.d/init.d/exim start,exim,root|mailnull,220 |EHLO localhost|250 |AUTH PLAIN %service_auth_plain%|2|QUIT|2
    
    In our example we try to talk to port 25 and issue a few commands you can change this up to do what you would like with the | being the break.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. thomassmart

    thomassmart Registered

    Joined:
    Nov 4, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    perfect, thank you! :)
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice