VMware Cloud Community
Matt-IT
Contributor
Contributor

About crontab and SSH

Hello,

I have a problem with Crontab and SSH.

The goal is to activate and disable SSH automaticaly on a server ESXi 7.
To do so, I modify "/var/spool/cron/crontabs/root" by adding these lines:

30 06 * * 1 /etc/init.d/SSH start
00 19 * * 1 /etc/init.d/SSH stop

Next, I kill crond, and restart it with "/usr/lib/vmware/busybox/bin/busybox crond"

And, it works... The first day of the week at 6.30am, SSH starts.
But at 7.00pm, I have a strange behavior. If I go to the web console, SSH is disabled.
If I try to connect by SSH, it works! And if I go again to the web console and refresh, SSH is now enabled....

Funny part, I have many servers with this configuration, and sometimes ssh stopped well, and sometimes, not...
All servers are strictly identical (same model, same ESXi version)

Do you know how I can resolve this probem?
I also can't find any crontab logs. Do you know where I can find them?

Thanks in advance,

Reply
0 Kudos
0 Replies