Cron: Difference between revisions

imported>Sjau
No edit summary
imported>Sjau
<code> is easier to spot that <tt>
Line 2: Line 2:
==General==
==General==


Cron is a very useful tool to run stuff at predefined times. Users, if allowed, can setup their own cron job, while the system crontab can be easily setup from the <tt>configuration.nix</tt>
Cron is a very useful tool to run stuff at predefined times. Users, if allowed, can setup their own cron job, while the system crontab can be easily setup from the <code>configuration.nix</code>


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 14: Line 14:
</syntaxHighlight>
</syntaxHighlight>


The above example would run the command <tt>date >> /tmp/cron.log</tt> as <tt>root</tt> user every <tt>5 minutes</tt> (indicated by <tt>*/5*</tt>. For more information regarding the cronjob entries, see the link below.
The above example would run the command <code>date >> /tmp/cron.log</code> as <code>root</code> user every <code>5 minutes</code> (indicated by <code>*/5*</code>. For more information regarding the cronjob entries, see the link below.


==Loading environment==
==Loading environment==
Line 24: Line 24:
</syntaxHighlight>
</syntaxHighlight>


The <tt>. /etc/profile;</tt> part first sources the profile file and hence loading the environment. After that, the actual command is being run in the proper environment. The above entry would run the rss2email program every 10 minutes as user <tt>johndoe</tt>
The <code>. /etc/profile;</code> part first sources the profile file and hence loading the environment. After that, the actual command is being run in the proper environment. The above entry would run the rss2email program every <code>10 minutes</code> as user <code>johndoe</code>


=See also=
=See also=