
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yokel Economics &#187; Cron</title>
	<atom:link href="http://192.168.0.198/archives/tag/cron/feed" rel="self" type="application/rss+xml" />
	<link>http://192.168.0.198</link>
	<description>Writings, notes, and data</description>
	<lastBuildDate>Mon, 30 Mar 2026 02:04:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Install cron on Fedora 38</title>
		<link>http://192.168.0.198/archives/1042</link>
		<comments>http://192.168.0.198/archives/1042#comments</comments>
		<pubDate>Tue, 22 Oct 2024 07:38:48 +0000</pubDate>
		<dc:creator>Yokelheim</dc:creator>
				<category><![CDATA[Computing Notes]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://192.168.0.198/?p=1042</guid>
		<description><![CDATA[dnf install cronie systemctl enable crond.service systemctl start crond.service]]></description>
			<content:encoded><![CDATA[<pre class="prettyprint">dnf install cronie
systemctl enable crond.service
systemctl start crond.service</pre>
]]></content:encoded>
			<wfw:commentRss>http://192.168.0.198/archives/1042/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash and *nix Note no. 2</title>
		<link>http://192.168.0.198/archives/6</link>
		<comments>http://192.168.0.198/archives/6#comments</comments>
		<pubDate>Wed, 10 Jan 2024 06:18:42 +0000</pubDate>
		<dc:creator>Yokelheim</dc:creator>
				<category><![CDATA[Computing Notes]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<category><![CDATA[WSL]]></category>

		<guid isPermaLink="false">http://192.168.0.198/?p=6</guid>
		<description><![CDATA[&#160; This document contains some notes on .bashrc for use with Linux systems. alias ll=&#8217;ls -alF&#8217; alias la=&#8217;ls -A&#8217; alias l=&#8217;ls –CF&#8217; if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi The preceding two blocks come standard on Ubuntu as of version 2022.04. One tweak for WSL2 on Windows might be the addition of this [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>This document contains some notes on <em>.bashrc</em> for use with Linux systems.</p>
<blockquote><p>alias ll=&#8217;ls -alF&#8217;<br />
alias la=&#8217;ls -A&#8217;<br />
alias l=&#8217;ls –CF&#8217;</p></blockquote>
<blockquote><p>if [ -f ~/.bash_aliases ]; then<br />
. ~/.bash_aliases<br />
fi</p></blockquote>
<p>The preceding two blocks come standard on Ubuntu as of version 2022.04. One tweak for WSL2 on Windows might be the addition of this line.</p>
<blockquote><p>sudo bash “/etc/rc.local”</p></blockquote>
<p>and in the rc.local follow, add the following.</p>
<blockquote><p>#!/bin/bash<br />
rm -f /etc/resolv.conf<br />
echo &#8220;nameserver 1.1.1.1&#8243; &gt;&gt; /etc/resolv.conf<br />
echo &#8220;nameserver 8.8.8.8&#8243; &gt;&gt; /etc/resolv.conf</p></blockquote>
<p>This is because WSL2 may place non-routable IP addresses using 172… in <em>resolv.conf</em>. As of this writing, following steps recommended to disable the generation of the file fails to resolve the issue where the file is newly generated with every new terminal launched in Windows terminal. Having this run with each new Bash login ensures success with network communications.  The location /etc/rc.local may seem like an odd location for this.</p>
<p>The crontab to ensure to check each minute to ensure a virtual machine is running in VirtualBox is as follows.</p>
<blockquote><p>*/1 * * * * VBoxManage startvm &#8220;VMNAME&#8221; &#8211;type headless<br />
*/1 * * * * VBoxManage startvm &#8220;VMNAME2&#8243; &#8211;type headless</p></blockquote>
<p>If the virtual machine is already running, then it will not start a new copy of it. This is better than attempting to run the script via a system wide script after a reboot.  Running it this way allows a simple crontab for the user for whom the machine needs to run under. To run a script every five minutes, add the crontab as follows:</p>
<blockquote><p>*/5 * * * * /home/USERNAME/nextcloudcron</p></blockquote>
<p>In this example, the <em>nextcloudcron</em> script will run every five minutes.  This particular script is one for use contacting my Nextcloud instance for webcron.  It does not contain a .sh on the filename, because some implementations may disallow crontab scripts with file extensions.</p>
<p>The following checks inside a subdirectory and pulls in the files therein as bash sources. This is useful for breaking aliases, variables, and other items into different files.</p>
<blockquote><p>if [ -d ~/.bashrc.d ]; then<br />
for rc in ~/.bashrc.d/*; do<br />
if [ -f "$rc" ]; then<br />
. &#8220;$rc&#8221;<br />
fi<br />
done<br />
fi</p></blockquote>
<p>The following uses nano as the crontab editor.</p>
<blockquote><p>export VISUAL=nano</p></blockquote>
<p>On Oracle Linux 9 on AWS, it is necessary to install <em>Cronie</em> to enable cron jobs.  To ensure this starts after reboots, add the following to <em>/etc/rc.local</em>.</p>
<blockquote><p>bash /sbin/crond</p></blockquote>
<p>To create a date line for a log file, use the following:</p>
<blockquote><p>echo $(date) &gt;&gt; /home/USER/FILENAME</p></blockquote>
<p>The Shebang for the top of bash files is</p>
<blockquote><p>#!/usr/bin/env bash</p></blockquote>
<p>To auto-update via DNF and leave a log of what was accomplished, use the following script.  The script will write a list of the updates to the systemupdates.log file, and then update the system with details of that process written to the dnfupdates.log file.</p>
<blockquote><p>#!/usr/bin/env bash<br />
echo $(date) &gt;&gt; /home/USER/systemupdates.log<br />
sudo dnf check-update &gt;&gt; /home/USER/systemupdates.log<br />
echo $(date) &gt;&gt; /home/USER/dnfupdates.log<br />
sudo dnf update -y &gt;&gt; /home/USER/dnfupdates.log 2&gt;&amp;1</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://192.168.0.198/archives/6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
