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.

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:
    16
    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:
    6
    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.
     
  3. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    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:
    6
    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
     
  5. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    Thanks a lot! It works perfect!
     
Loading...

Share This Page