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.

REQUEST: Run special SSH commands

Discussion in 'General Discussion' started by EcpHosting, Feb 24, 2003.

  1. EcpHosting

    EcpHosting Well-Known Member

    Joined:
    Dec 16, 2002
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    I would like a script to be able to run commands similiar to the following:

    cd /home/user/
    wget http://www.domain.com/file.tar
    tar -xf file.tar
    del -f file.tar
    mv /home/user/file /usr/local/lib

    ... and a list of other root commands, to be performed after every day after each CP update. I know there has to be some easy way I have not heard of yet, but this would be a script to be run from cron... i just dont know how to program this script... of course it's not a simple cron as its extracting files in specific folders... unless you know a cron command to do this. :D

    Any folks know of a way to do this? I would be most grateful.
     
  2. rpmws

    rpmws Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    1,824
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    back woods of NC, USA
    I am no expert but I **think** you can simply add those to a flat file and save it as a script.sh file and then run that file from the cron.

    Try putting those in a file and then running the script.sh to see if the rest are executed also. Once you get it working just cron that sucker :)
     
  3. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    I do stuff like that with cgi. I write a script to do what I want and schedule it with cron.

    In a cgi script, just put the shell command like this:
    system("shell command with options");
     
  4. ecoutez

    ecoutez Well-Known Member

    Joined:
    May 23, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    0
    Re: Re: REQUEST: Run special SSH commands

    Yup - just don't forget a hash bang
    - Jason
     
Loading...

Share This Page