• Posted July 8, 2013


How can i via crontab add a mysqldumb that runs every day at 21:00 CET (danish time)

and put it in /home/xxx


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Got it Working \o/ <br> <br>Steps : <br> <br>1. chmod 640 /etc/ssmtp/ssmtp.conf <br>2. chown root:mail /etc/ssmtp/ssmtp.conf <br>3. nano /etc/passwd <br>4. changed : root:x:0:0:root:/root:/bin/bash <br>5. To root:x:0:0:root@TheCloud,:/root:/bin/bash

can i add a from mail adress : right now it reads “root”

Got it working :) <br> <br>#!/bin/bash <br> <br>suffix=$(date +%Y-%m-%d) <br> <br>rm /home/backup/db/$suffix.sql.gz <br>mysqldump -h localhost -u root -pxxx db | gzip > /home/backup/db/$suffix.sql.gz <br>echo “Mysql Backup Completed” | mail -s “Backup Completed” <br>echo Backup completed

Add this as a cronjob (and remove the other ones): <br> <br>0 21 * * * /bin/bash /home/xxx/ <br> <br>Script: <br> <br>#!/bin/bash <br> <br>suffix=$(date +%Y-%m-%d) <br> <br>rm /home/backup/xxx/$suffix.sql.gz <br>mysqldump -h localhost -u root -pxxx db | gzip > /home/backup/xxx/$suffix.sql.gz <br>echo “MySQL backup” | mail -s “MySQL backup”

how : <br> <br>i have this in the script <br> <br>#!/bin/bash <br> <br>suffix=$(date +%Y-%m-%d) <br> <br>rm /home/backup/xxx/$suffix.sql.gz <br>mysqldump -h localhost -u root -pxxx db | gzip > /home/backup/xxx/$suffix.sql.gz <br>

missed a " :D but there is no body text (content) only subject does contain what i want

Add it to the script itself not the cronjob.

I tried this : * * * * * /bin/echo “foobar” >> /home/backup/testfile.txt echo "Mysql Backup Cpmpleted | mail -s “Backup Completed” <br> <br>But get this error in my mail : /bin/sh: 1: Syntax error: Unterminated quoted string

Yes, append this to <br> <br>echo “MySQL backup” | mail -s “MySQL backup”