Hi Folks,
Need some with getting a cron job to run.
I’m using this script that found in another CRON related thread:
#!/bin/bash
# script needs these to use Hestia Tools
export HESTIA=/usr/local/hestia
export PATH=$PATH:/usr/local/hestia/bin
# Loop through Users
for USER in $( /usr/local/hestia/bin/v-list-users plain | awk '{print $1}' )
do
DIR="/home/$USER/dbbackup"
echo "= Processing $USER "
# Make dir if this is the first time
if [ ! -d "$DIR" ] ; then
echo "Creating dir"
mkdir -p "$DIR"
chown -f "$USER":"$USER" "$DIR"
fi
# Loop through hestia DBs for that user
for DB in $( /usr/local/hestia/bin/v-list-databases "$USER" plain | awk '{print $1}' )
do
# Dump DB
/usr/bin/mysqldump --defaults-extra-file=/root/.my.cnf --quick --single-transaction --skip-add-locks "$DB" | gzip > "$DIR"/"$(date +%F-%H-%M)"_"$DB".tar.gz
# Pause to give the server a break
sleep 10
done
# fix perms (silently)
chown -f "$USER":"$USER" "$DIR"/*.tar.gz
# Keep only last three days' files locally. Older can be recovered from offsite backup
echo "Deleting old backups in $DIR"
find "$DIR" -name '*tar.gz' -mtime +3 -delete
done
I have the file located in /usr/local/hestia/bin.
When logged in as root in SSH, I can run the file manually with the command:
sudo /usr/local/hestia/bin/sqlbackup.sh > /home/nolatron/web/domain.com/private/sqlbackups/myjob.log 2>&1
And this works fine.
So I created a CRON job under the admin account:
But nothing ever runs. syslog shows it being logged:
Sep 12 14:08:01 ghibli CRON[3080146]: (admin) CMD (sudo /usr/local/hestia/bin/sqlbackup.sh > /home/nolatron/web/domain.com/private/sqlbackups/myjob.log 2>&1)
I don’t have email setup on this server so I don’t think I can get it to send any email results.
I’m just not sure what else I’m missing to figure out why the CRON can’t run it.
Thanks!
Shaun