Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I uploaded the cronjob but it wont backup my database. the error email is:

mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
//etc/cronjob.sh: line 48: mutt: command not found

my cronjob file is:




#Keep the " around your address

#Change the 'wp_' to match your table_prefix in the database
mysqldump --opt -u $DBUSER -p$DBPASS $DBNAME > backup.sql
gzip backup.sql
DATE=`date +%Y%m%d` ; mv backup.sql.gz $DBNAME-backup-$DATE.sql.gz
echo 'Blog Name: Your mySQL Backup is attached' | mutt -a $DBNAME-backup-$DATE.sql.gz $EMAIL -s "MySQL Backup"
rm $DBNAME-backup-$DATE.sql.gz

how can i fix this problem?

share|improve this question
You have two problems there: you can't find /var/lib/mysql/mysql.sock and you can't find mutt. Try finding where those files are first. –  Ladadadada Jun 20 '12 at 22:15
Does the script work when you run it manually? –  mgorven Jun 20 '12 at 22:24
my server tech support said; "mutt is not supported on this server. You will need to either modify the cronjob.sh script, or get a different script that accomplishes the same thing without mutt." i am not good at these. how can i add different script? –  1907 Jun 20 '12 at 23:06
You probably have mailx but it's a bit more complicate getting it to send attachments. scp would be a better choice than email anyway. –  Ladadadada Jun 21 '12 at 5:58
So little help would be perfect to make this cron work. İt doesnt matter for me eather mailx or scp :) –  1907 Jun 21 '12 at 6:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.