I have bellow bash for full backup of MySQL database(Centos 7), And worked perfect.
MyBackupDb.sh file :
mysqldump -u root -pHERE THERE IS MY PASSWORD --all-databases > /opt/db_backups/database_`date +%d%m%y`.sql
When I execute /bin/bash /root/MyBackupDb.sh
that work perfect.
But when I set bellow command in /etc/crontab :
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
14 0 * * * /bin/bash /root/MyBackupDb.sh
The crontab have erorr /bin/bash ERROR (getpwnam() failed)
error.
Note : MyBackupDb.sh
have 755 permission.