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.

Need Help with my Cron Job Script [moved]

Discussion in 'Data Protection' started by psquillace, Aug 22, 2006.

  1. psquillace

    psquillace Registered

    Joined:
    Aug 22, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hello All:
    Over the past 3 days I have tried every cron job imagineable to get my backup script to run.

    Let me start at the begining, I have a backup script in php that will backup all my reseller accounts on my shared hosting. The problem is, I want to make a cron job so I do not have to run it every week.

    I set up in the cpanel to run http://www.gzws.com/backup.php in standard mode but that did not work.

    then, I set up php http://www.gzws.com/backup.php which returned it could not find the file backup.php but it was on my public server.

    I tried the example GET: that cpanel offers however I get an error saying that GET is not a valid command.

    Can someone tell me if I put this file in WWW or Public_html folder how do I make a cron job for it in standard mode.

    I got the selecting the time thing down, I just need to know what to do in that command line input box.

    whew...

    thanks for any advice or help,

    Paul
     
  2. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    if you are running a php script from a cron job you will need to call the script by its unix path rather than the url itself

    e.g. php /home/username/public_html/backup.php
     
  3. psquillace

    psquillace Registered

    Joined:
    Aug 22, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Nick,
    I will try that and let you know what happens.

    Paul
     
  4. psquillace

    psquillace Registered

    Joined:
    Aug 22, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Got a weird message

    I don't know what this means but I got this from Cron Just now off my cpanel when I ran the script:

    ar: Removing leading `/' from member names
    tar: /home/gzws/public_html/media/silverion/SangKuriaNgs.usr: Cannot open: Permission denied
    tar: /home/gzws/public_html/media/silverion/si-kancil.chn: Cannot open: Permission denied
    tar: /home/gzws/public_html/media/silverion/Kalor-Ijau.chn: Cannot open: Permission denied
    tar: /home/gzws/public_html/media/silverion/SangKuriaNgs.chn: Cannot open: Permission denied
    tar: /home/gzws/public_html/media/silverion/si-kancil.usr: Cannot open: Permission denied
    tar: /home/gzws/public_html/media/silverion/Kalor-Ijau.usr: Cannot open: Permission denied
    tar: Error exit delayed from previous errors
    X-Powered-By: PHP/4.4.3
    Content-type: text/html

    - - End Script Here - -

    If you want to exclude a directory, add the --exclude parm to the tar command as shown in the example below (which will exlcude the public_html/audio directory):
    system("tar --create --preserve --gzip --file=".$target." --exclude ~/public_html/audio ~/public_html ~/mail",$result);


    I am assuming this is cause of the script I hav and not the cron job I just set up.

    thanks for any advice again.

    Paul
     
  5. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    indeed it is, the script doesnt have permission over the files its trying to tar
     
  6. psquillace

    psquillace Registered

    Joined:
    Aug 22, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Great,

    thanks again Nick for all your help.
     
Loading...

Share This Page