Vzctl exec2 not working in crontab

Tag: openvz Author: jeff_qiu00 Date: 2014-04-23

I am trying to run below command in root crontab of host node but its not working.

vzctl exec2 1 "cd /root/mysqlbackup && mysqldump -u username -h dbhost -ppassword dbname | gzip -9 > mysql_date +%Y%m%d_%H%M%S.sql.gz" >/dev/null 2>&1

When I run this in terminal its working perfectly but not working in crontab.

need help to fix this thank you in advance

Ensure that scripts running under cron have a PATH variable that includes the location of mysqldump, see here, nice overview of things that can go wrong with cron here
thank you solved by adding PATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin