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.

Cron Job for FTP Backup Gives Me Somewhat Mysterious Email Error Notification

Discussion in 'Data Protection' started by stevrons2, Aug 28, 2013.

  1. stevrons2

    stevrons2 Registered

    Joined:
    Aug 27, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Greetings,
    I looked on the boards and could not find this specific issue addressed so I hope to find a solution through this post. I have set up a Cron Job with the following script below to do an FTP backup of a particular file and have it sent through ftp to a remote storage account, specifically a storage account I have with FilesAnywhere. Now when I run the backup I get an email notification from Cron which says :

    "(remote-directory) The system cannot find the file specified"

    At first because it referred to the remote directory, I thought maybe it was not connecting to the ftp location correctly, or couldn't find the backup directory location, so I messed with the backup directory and when I did that I would get an email error message of "Bad directory components" so I changed back the backup directory to be for the root of the ftp site. Now I think the error about system not finding file specified has to do with the actual file on the local site. I have messed with that part of the code, but keep getting that error email message. The path of the file from the root of my hosting account is /var/www/vhosts/website.com/httpdocs/ but when I put in that path it does not work. I have the feeling either something in the script below is off, or I'm just not nailing down the path to the file correctly, as I'm not sure what the path should be relative to, relative to the root of the hosting account, relative to the location of my backup script file, or relative to something else.



    #!/bin/bash
    # Put FTP server details here
    SERVER="ftp.remotelocation.com"
    USERNAME="MYNAME"
    PASSWORD="goodpassword"

    # local directory containing source backup file
    SOURCEFILES="/tmp/"

    # remote server directory path in which backup needs to be put in
    BACKUPDIRECTORY=""

    # login to remote server
    ftp -n -i $SERVER <<EOF
    user $USERNAME $PASSWORD
    cd $BACKUPDIRECTORY
    mput $SOURCEFILES/*.*
    quit
    EOF



    Any help or insight would be terrific. Thanks
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Are you sure that is the correct path? The default path for an account on a cPanel server is:

    # /home/username/public_html

    It looks like you may be using a path that was used in the past on another control panel.

    Thank you.
     
  3. stevrons2

    stevrons2 Registered

    Joined:
    Aug 27, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner


    Thanks for the reply. That corrected path you gave doesn't seem to work either. Does that error message I get by email necessarily mean that it's the path that is incorrect? Or is there any possibility it's the remote ftp location that is the issue?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    It depends which directory is listed in the exact error message. Have you checked to see if the path exists? Access your server via SSH and run a command such as:

    # stat /path/to/filename

    Thank you.
     
  5. stevrons2

    stevrons2 Registered

    Joined:
    Aug 27, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    the error message that I receive via email has no file path, the only text in the email is :

    "(remote-directory) The system cannot find the file specified"

    As far as the path itself, I do know it exists yes, it's the same path that is used to point to the backup script itself (backup.sh) when I set up the Cron Job
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    It looks like the script is attempting to access a file that does not exist. You may need to review the actual backup script and look for instances where an invalid path is defined.

    Thank you.
     
  7. stevrons2

    stevrons2 Registered

    Joined:
    Aug 27, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    The file definitely exists, the question may be what is the file path needed. Is it the file path from the root of the domain, or a path relative to the location of the script itself, or a path relative to somewhere else. I tried the first two possibilities and neither worked.

    Is there some documentation that shows definitively what all cron error messages mean? I mean this one "seems" straightforward, but who knows. Was also hoping to run into someone who has gotten the same error message and found the solution.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Feel free to open a support ticket so we can take a closer look:

    Submit A Ticket

    You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
Loading...

Share This Page