The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    1
    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:
    746
    Likes Received:
    11
    Trophy Points:
    18
    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.
     
  3. thomassmart

    thomassmart Registered

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

Share This Page