Want to set up a simple Cron Job for Automatic Full Backups.

hectron

Registered
Oct 21, 2011
2
0
51
cPanel Access Level
DataCenter Provider
Hi everyone,

I was perusing through the forums and kept on seeing a lot of different solutions to do this but I wanted to keep things simple.

I am using cPanel 11.30.4 build 6 running linux.

Objective: I wanted to run a cron job on a daily basis, scheduled to run at 9 P.M. The backups are to be saved in the /home/foo directory. I plan on writing a simple .sh script which is to be executed, triggering the nightly full backup.


Here are the steps which I have taken:



Within the main console, I navigate down to Cron jobs. A new cron job is set up with the following settings:

Minute: 0
Hour: 21
Day: *
Month: *
Weekday: *

Command:
Code:
sh /home/foo/backup.sh
This is the code within backup.sh:

Code:
#!/bin/sh


wget -O /dev/null -q –no-check-certificate –http-user=$1 –http-password=$2 https://foo.hostgator.com:port/frontend/x3/backup/fullbackup.html –post-data=”dest=homedir&email=$3&email_radio=1&user=$1&pass=$2″
Issue: To verify that the script is working, I have changed the cron schedule to run every 3 minutes. I have not received any e-mails regarding whether or not the script has been run.

Ideas: I thought that this might have something to do with wget and https. To resolve that issue, I used the -no-check-certificate.

Any ideas where I can be going wrong?


EDIT: I got in contact with the HostGator.com representatives and it seems that a lot of this lies on the script. Furthermore, cron jobs are only allowed every 15 minutes for my type of account. As a result, they were not running.

I tweaked everything a little bit.

The command is now:

Code:
/home/foo/backup.sh "username" "password" "email" 2>>/home/foo/error.log
 
Last edited:

hectron

Registered
Oct 21, 2011
2
0
51
cPanel Access Level
DataCenter Provider
Thank you for the advice, all. I ended up changing the page name "fullbackup.html" to "dofullbackup.html" as minosjl suggested and that did the trick.

Thank you all!