haven't been able to find a simple file backup to run as a cron - i have a shell file that didn't work, and a php file that works in browser but not as a cron...

anyone help?

thanks much

    #!/bin/sh
    FILE=/home/un/public_html/ctr/var/access.php
    BACKUP_FILE=/home/un/public_html/ctr/var/access2.php
    mv ${FILE} ${BACKUP_FILE}
    

    call it with GET /home/un/publicc_html/do_backup.sh ?

    didn't work...

    thanks

      Well, for backup purposes, you probably want to copy, not move. Helps to quote around your variables too, things like "var" could confuse it without. Also, brackets shouldn't be around the variables in shell. Try this:

      #!/bin/sh
      FILE="/home/un/public_html/ctr/var/access.php"
      BACKUP_FILE="/home/un/public_html/ctr/var/access2.php"
      mv $FILE $BACKUP_FILE

      Then give it permissions(chmod 755), and run it. /path/to/backup_script.sh

        'prece - one thing: copy vice move, i agree - but it still looks like move at the bottom "mv $FILE $BACKUPFILE"...

        yes? no? what's copy, cp?

          i'm still getting an empty file with this...

          GET /home/un/public_html/do_backup.sh ?

            man, something's wrong - i've 777'd everything - nothing is writing to the backup file...

              Don't use GET. The command is strictly

              /path/to/file.sh

              The shebang tells it what binary to use...

                " /bin/sh: /home/un/public_html/do_backup.sh: /bin/sh
                : bad interpreter: No such file or directory "

                  Write a Reply...