Link to home
Start Free TrialLog in
Avatar of Eric Miller
Eric Miller

asked on

Cron job never runs on vCenter 6.5 appliance

I have a script that will backup vcenter 6.5 via https://vm.knutsson.it/2017/01/vmware-vcsa-6-5-scheduled-backup/.  The script runs just fine when I manually run it.  But my cron job never runs, and I can't even find any logs to troubleshoot it.  I log in with root via SSH and run crontab -e.  I then add the following line: 0 2 * * * /usr/local/bin/vcsabackup.sh.  Nothing ever happens.
Avatar of Member_2_3684445
Member_2_3684445
Flag of Netherlands image

You should add a user that should be used to run the script.
# 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

Open in new window


Like
# Run this script at 2:00h every day of every month every day of the week using the user root. 
0 2 * * * root /usr/local/bin/vcsabackup.sh

Open in new window


The logging is (RHEL):
cat /var/log/cron

Also make sure the crond is running (RHEL).
/etc/init.d/crond status
Avatar of Eric Miller
Eric Miller

ASKER

Thanks for reaching out.  I tried adding the root user to it, but it still didn't work.  That log isn't the correct location because it's not RHEL.  It's the Linux version that comes on VMware vCenter 6.5 appliance.  Crond service is running though.
Sadly Im not familair with vCenter. Does vCenter offer manpages you can consult?

usually command: 'man 5 crontab' (5 is the Cronie Users Manual on most distro's)
I found the log location which led me down the right path.  On the vcenter appliance it is at /var/log/messages.  The error in the log led me to this article which was the problem.  https://www.drewgreen.net/wordpress/2017/04/19/fix-for-cron-failing-on-vmware-vcenter-server-appliance-vcsa-6-5/

There is no password-auth file.  The crond file needs to have system-auth instead of password-auth.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_3684445
Member_2_3684445
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the tip.