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!

Run Script when server starts

Discussion in 'General Discussion' started by CoolMike, Jan 4, 2008.

  1. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    316
    Hi

    I'm using Centos and need to run a script when the server starts. It need to run before spamd starts. I think /etc/rc.d/rc.local will run the script at the end, what's the name of the file which is executed before spamd?

    Thanks
    Michael
     
  2. troxalias

    troxalias Well-Known Member

    Joined:
    Nov 21, 2001
    Messages:
    96
    Likes Received:
    0
    Trophy Points:
    306
    Location:
    Athens - Greece
    Spamd is started within the Exim init script. You can either edit this file and execute your script or even better create your own init script and run it before that of exim. Exim start priority is 80 and stop priority 30.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    316
    Thanks for the information. I think it's not a good idea to modify the exim startup script, because cpanel will overwrite this maybe. How can I make my own init script? I have to run the following script:

    /etc/mail/spamassassin/cmae/cloudmark/bin/cmaed start

    Thanks
    Michael
     
  4. troxalias

    troxalias Well-Known Member

    Joined:
    Nov 21, 2001
    Messages:
    96
    Likes Received:
    0
    Trophy Points:
    306
    Location:
    Athens - Greece
    Add the following at the beginning of the script

    #!/bin/sh
    #
    # chkconfig: 2345 79 29
    #


    and then run the commands:

    cd /etc/mail/spamassassin/cmae/cloudmark/bin/
    ln -s cmaed /etc/init.d
    chkconfig --add cmae
    chkconfig cmae on
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    316
    Thanks a lot! It works perfect!
     
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