Ubuntu scheduled task cannot back up mysql, backup files are empty

-sharp!/bin/bash

file_name2=`date +%Y%m%d%H%M%S`
mkdir    /home/sql_bak/user_bak/$file_name2
chmod   7777        /home/sql_bak/user_bak/$file_name2

-sharp-sharp-sharp-sharp
arr_string=(users payrecord_fruitcoin yamirecord vipexam_record stream_order ios_pay)

for data in ${arr_string[@]}
do
mysqldump -hrm-&&&&&&com -ubi&&&&&&jy -pZho&&&&&9xx 2>/dev/null --set-gtid-purged=off     ${data}    > /home/sql_bak/user_bak/$file_name2/${data}.sql
done

above is the backup script. If executes the script manually, the backup can be successful .

but.
all the files backed up by joining scheduled tasks are empty .

the figure is as follows:

results of manual backups clipboard.png
..]

:

clipboard.png

clipboard.png

:

clipboard.png

Mar.04,2021

  1. it is recommended that you add source / etc/profile or PATH=$PATH before the script
  2. can execute / bin/bash-x xxxx.sh can clearly see the script execution steps, easy to analyze.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea259a-1bcc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea259a-1bcc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?