<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.tinkernet.ca/index.php?action=history&amp;feed=atom&amp;title=ESXi_-_Add_cron_Job</id>
	<title>ESXi - Add cron Job - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tinkernet.ca/index.php?action=history&amp;feed=atom&amp;title=ESXi_-_Add_cron_Job"/>
	<link rel="alternate" type="text/html" href="https://wiki.tinkernet.ca/index.php?title=ESXi_-_Add_cron_Job&amp;action=history"/>
	<updated>2026-04-15T15:40:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.tinkernet.ca/index.php?title=ESXi_-_Add_cron_Job&amp;diff=165&amp;oldid=prev</id>
		<title>Tinker: Created page with &quot;Stolen directly from http://www.jules.fm/Logbook/files/add_cron_job_vmware.html because the site seems only semi-functional (&amp; might go away...).  ==Add cron Job to VMware ESX...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.tinkernet.ca/index.php?title=ESXi_-_Add_cron_Job&amp;diff=165&amp;oldid=prev"/>
		<updated>2020-06-12T03:32:07Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Stolen directly from http://www.jules.fm/Logbook/files/add_cron_job_vmware.html because the site seems only semi-functional (&amp;amp; might go away...).  ==Add cron Job to VMware ESX...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Stolen directly from http://www.jules.fm/Logbook/files/add_cron_job_vmware.html because the site seems only semi-functional (&amp;amp; might go away...).&lt;br /&gt;
&lt;br /&gt;
==Add cron Job to VMware ESX/ESXi==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This explains how to add a cron job to VMware in such a way that it will still be there after reboots.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Having [http://www.virtubytes.com/2017/04/21/enable-ssh-vmware-esxi-6-5/ enabled ssh access] to your ESX/ESXi server, ssh in as root.&amp;lt;br /&amp;gt;Firstly, add the cron job to the root crontab:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Edit &amp;lt;code&amp;gt;/var/spool/cron/crontabs/root&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the line (all on one line) &amp;lt;code&amp;gt;5 0 * * * /full/path/to/script arguments/with/full/path &amp;gt; /full/path/to/logfile 2&amp;gt;&amp;amp;1&amp;lt;/code&amp;gt;&lt;br /&gt;
#Run the command &amp;quot;&amp;lt;code&amp;gt;'''cat /var/run/crond.pid'''&amp;lt;/code&amp;gt;&amp;quot; That will print the process number of the running crond, such as 12345&lt;br /&gt;
#Run the command &amp;quot;&amp;lt;code&amp;gt;'''kill 12345'''&amp;lt;/code&amp;gt;&amp;quot; where &amp;quot;&amp;lt;code&amp;gt;12345&amp;lt;/code&amp;gt;&amp;quot; should be replaced with the number output by the previous command&lt;br /&gt;
&lt;br /&gt;
For details of the meaning of &amp;quot;5 0 * * *&amp;quot; (5 minutes past midnight every day) read the man page for crontab(5) on any Unix/Linux server, or else [http://www.manpagez.com/man/5/crontab/ on the web].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Now, add a command to &amp;lt;code&amp;gt;/etc/rc.local.d/local.sh&amp;lt;/code&amp;gt; to re-generate the cron job when ESX/ESXi reboots&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Edit &amp;lt;code&amp;gt;/etc/rc.local.d/local.sh&amp;lt;/code&amp;gt;, using a command such as &amp;quot;&amp;lt;code&amp;gt;'''vi /etc/rc.local.d/local.sh'''&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
#At the end of the file, add 3 lines (using &amp;quot;'''G'''&amp;quot; then &amp;quot;'''O'''&amp;quot; in vi). The first kills crond, the second adds the new cron job to the root crontab file, ad the third restarts crond:&lt;br /&gt;
#*&amp;lt;code&amp;gt;/bin/kill $(cat /var/run/crond.pid)&amp;lt;/code&amp;gt;&lt;br /&gt;
#*&amp;lt;code&amp;gt;/bin/echo '5 0 * * * /full/path/to/script arguments/with/full/path &amp;gt; /full/path/to/logfile 2&amp;gt;&amp;amp;1' &amp;gt;&amp;gt; /var/spool/cron/crontabs/root&amp;lt;/code&amp;gt;&lt;br /&gt;
#*&amp;lt;code&amp;gt;/usr/lib/vmware/busybox/bin/busybox crond&amp;lt;/code&amp;gt;&lt;br /&gt;
#Save and exit the editor (Press the &amp;quot;'''Esc'''&amp;quot; key then &amp;quot;''':wq'''&amp;quot; then press &amp;quot;'''Return'''&amp;quot; in vi)&lt;br /&gt;
#Run the command &amp;quot;&amp;lt;code&amp;gt;'''auto-backup.sh'''&amp;lt;/code&amp;gt;&amp;quot; so that the change to &amp;lt;code&amp;gt;/etc/rc.local&amp;lt;/code&amp;gt; survives a reboot.&lt;br /&gt;
&lt;br /&gt;
Every time you change the cron job, remember to update &amp;lt;code&amp;gt;/etc/rc.local&amp;lt;/code&amp;gt; as well and run the &amp;quot;&amp;lt;code&amp;gt;'''auto-backup.sh'''&amp;lt;/code&amp;gt;&amp;quot; command to backup the new &amp;lt;code&amp;gt;/etc/rc.local&amp;lt;/code&amp;gt; file.&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tinker</name></author>
		
	</entry>
</feed>