I've got no idea in the world about what I'm doing here, so seeking help from experts
Our school runs a forum and is now too large to backup fully via phpmyadmin and I've been advised I need to create a "cronjob" and a "shell script" to create a mySQL backup of a database running off Plesk 7
First time I had ever heard the word "cronjob" but was advised to seek help here
So basically if anybody could help, what do I need to achieve a mysql database backup once a week on an early Sunday morning (in gzip format is preferred if possible) to output to a folder on our server called root/private
Our database details are
db - forum
u - forumuser
p - forumpass
and it is in the path of ourdomain.edu/forum/index.php
in our Plesk panel there is a crontab tab - so assuming I would want for 3am Sundays (if I worked this out right)
Day of the Month *
Day of the Week 0
Command (command for the script I need?)
So I think I have the "cronjob" part worked out (maybe?) - just need a "shell script" now to spit out the backup
here are differences in environment when you run a cron, and when you run a script while logged in. It's typically a stripped-down shell, with a minimal $PATH, etc etc.
What I'd suggest doing is echoing everything that you're going to execute.
So, when you have your exec, echo what is actually being exec'd and so on. It may be that it doesn't know where gzip is, etc. It's usually something minor that screws up the whole thing, that's hard to track down, but easy to fix.
To spit out the database
As an additional note, if you wanted all of the potential output from all streams (stdout and stderr rather than just stdout), use: