Hi, I have a VPS working fine under cPanel and a shared linux account at godaddy to hold the daily backup's of the WHM.
This work's fine, but each day the files are over-write, I want to keep each day backup: "last 31 day".
I'm using this script that work perfect. #!/bin/sh
rm -rf /home/myaccount/server2/rotation/daily/$(date +"%d")
mkdir /home/myaccount/server2/rotation/daily/$(date +"%d")
cp -R /home/myaccount/server2/cpbackup/daily/* /home/myaccount/server2/rotation/daily/$(date +"%d")
But godaddy doesnt support cron !!
I supose that I can use my VPS cPanel cron to execute the script, but I dont know how to do it !!
Change the extension of your script to .cgi and/or put it in your cgi-bin directory.
Add this on the second line to make it a valid CGI script:
echo -ne "Content-type: text/plain\n\n"
If you don't have a cgi-bin directory on your shared account, then try the PHP system() function.
What all would that help?
Discoteca, do you have any server which can set up a cron job? Your VPS can, right? What i suggest is that you place your php script in a directory which has open_basedir restrictions off (this is somewhat a security risk if you do it gobally, but if you just do it for one dir where only you have access it wont be bad), use this to grap the backups, and then use php's FTP function to simply dump it on the godaddy account, this way you wont need to set up a cron job on the shared, but only on the VPS If that makes sense?
That should run it perfectly, if you want to get the results of the script, take away the > /dev/null 2>&1 and enter your email in the cron interface as well (on most control panels there's a place which says "email the output of the cron files to this address" or the like, simply enter your mail there, and i'll send you the result of each cron... when you have the > /dev/null 2>&1 part it simply sends the output to the trash can rather than an email which has been entered, the script still gets executed though )
You'll need to set the execute bit on your script (which you've probably already done), change the extension to .cgi so that Apache knows what to do with it, make the change I mentioned in post #7 so that it is a valid CGI script, and copy it into your cgi-bin directory so that Apache will run it. All this is dependent on your host's Apache configuration, but almost all hosts support CGI. Ask your host how to install a CGI script if necessary. You'll know it's working when you can visit the CGI script in your browser and see the output of the script. 404 or 500 errors will be your sign that your CGI script is not yet properly set up.
This solution does not require PHP, the script posted in the original post is not a PHP script, and there is absolutely no reason to involve PHP. (Unless your host does not support CGI, which is unlikely.)
Thank for all the help
But nothing work (Godaddy hosting is very poor).
The full story is.....
First I have a windows hosting, but backup from my VPS (at www.powervps.com) by FTP work only sometimes.
I talk with support and they told me, that the problem where at powervps (of course I talk with powervps and they say that everything was OK).
But I have an account with powervps for the last year and allways works fine, so I supose the problem was at godaddy.
I give a last try and change from godaddy hosting from windows to linux and FTP starts working fine.
Know I try the script and doesnt work, godaddy support say that everythin is OK, but I cant run any script.
I try another plan and change the script to php and start working, I call support and tell my experience.... the answer was incredible.... "sometimes happend that with cgi"
At this moment all is working fine right now (with a php script and using the cron of my vps).
PD: I'm staying with godaddy for the cheap price for 100Gb disk space (remember that I only use it for backup).