I am trying to take backup using below bash script scheduled in cron.
#!/bin/bash echo "Hello" while read table do /usr/bin/mysqldump -uroot -pxxxxxx CMAYA_RadiusUserLogs $table > sc_back/${table}.sql done < tables.txt cron is scheduled as below
58 16 * * * root /bin/sh -x /backup/call_backup.sh > /backup/backup.log /var/log/cron as below
Jul 3 16:27:01 (root) CMD (/bin/sh -x /backup/backup.sh > /backup/backup.log) /backup/backup.log
[root@ backup]# cat backup.log Hello When I execute this same script manually it works properly and put any other command in script it works in cron job.
/bin/sh -x scriptif your script already has a shebang line? ii) Where istables.txt? How is the script supposed to find it?