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!

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:
    156
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. rpmws

    rpmws Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    1,824
    Likes Received:
    7
    Trophy Points:
    318
    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 :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    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");
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ecoutez

    ecoutez Well-Known Member

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

    Yup - just don't forget a hash bang
    - Jason
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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