LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cronjob (https://www.linuxquestions.org/questions/linux-general-1/cronjob-54663/)

FastEddy 04-12-2003 12:25 AM

cronjob
 
I am running a cron job to backup a database.

1) Is there a way to have the file mailed to me?
2) How can I keep the old file from being overwritten each time the job runs? Can I have the filename change each time it runs?

I would like to run these as 2 separate jobs at different times to keep one set on the server and another off the server.

I have absolutely no clue what I'm doing.
Here is the command line I'm using now.


mysqldump -uXXXXX -pXXXXX -B XXdatabasenameXX> /home/XXXX/backup.sql

Thanks,
-Ed

pablob 04-12-2003 09:52 PM

#!/bin/bash

file = backup.sql.`date +%w`

mysqldump -uXXXXX -pXXXXX -B XXdatabasenameXX>/home/XXXX/$file
# Adds day of week number. For day of month: +%d


cat /home/XXXX/$file | mail -s Backup you@you.com


All times are GMT -5. The time now is 04:54 AM.