vSphere

Cronjob firing, but no successful exe… |VMware Communities


Hey folks,

 

I’ve got a weird problem on my free ESXi 6.7u3 Hypervisor regarding CRON.

 

I created a new user called “michael” with administrator privileges via the web-interface. Furthermore assigned the role “no access” to the “root” user (for hardening purposes).

 

 

Now i created the file /var/spool/cron/cronjobs/michael per SSH and pasted a simple command to test it (echo). The crontab-file looks as follows:

 

[michael@esxi:~] cat /var/spool/cron/crontabs/michael

28      13      *       *       *       /bin/echo “test” > /vmfs/volumes/Backup/log.txt

 

Then I killed the cron daemon, restarted it again and just waited until the time is over and watched the syslog.log:

 

[michael@esxi:~] kill $(cat /var/run/crond.pid)

[michael@esxi:~] crond

[michael@esxi:~] tail -f /var/log/syslog.log

[…]

2020-01-07T13:28:00Z crond[2108571]: USER michael pid 2108578 cmd /bin/echo “test” > /vmfs/volumes/Backup/log.txt

 

As you can see from the output above, the cronjob is firing properly, but no text file has been created on the given directory!

 

[michael@esxi:~] cat /vmfs/volumes/Backup/log.txt

cat: can’t open ‘/vmfs/volumes/Backup/log.txt’: No such file or directory

 

The path is correct and if I execute the command on myself in SSH, the text file will be created.

 

This problem also occurs when trying other cronjobs (like starting guest VMs).

 

Does anyone of you know why this is not working?

 

Thank you in advance,

Michael



Source link

 

To see the full content, share this page by clicking one of the buttons below

Related Articles

Leave a Reply