<chapter id="cronjob">
<title>Cronjobs</title>
<para>
OTRS needs a few system cronjobs to unlock tickets with lock timeouts, 
send reminder notifications and some other stuff.
</para>

<section id="cronjob-setup">
<title>How it works - setup</title>
<para>
There are several OTRS default cronjobs in $OTRS_HOME/var/cron/*.dist.
Make copies of all of the default cronjobs:
<programlisting>
cd var/cron
for foo in *.dist; do cp $foo `basename $foo .dist`; done
</programlisting>
Or if you are installing OTRS an a Windows system:
<programlisting>
cd var/cron 
copy *.dist *.
</programlisting>
Use $OTRS_HOME/bin/Cron.sh {start|stop|restart} to start or stop this cronjobs
from $OTRS_HOME/var/cron/* (.dist will be ignored).
</para>
<para>
Note: Install this cronjobs as OTRS user. 
</para>
</section>

<section id="cronjob-default-cronjobs">
<title>Default cronjobs</title>

<section>
<title>aaa_base</title>
<para>
Defined the email address of the OTRS admin which receive all cron error 
reports.
<programlisting>
MAILTO="root@localhost"
</programlisting>
</para>
</section>

<section>
<title>pending_jobs</title>
<para>
Processed every hour all reached "pending auto" tickets. 
<programlisting>
45 * * * * $HOME/bin/PendingJobs.pl >> /dev/null
</programlisting>
</para>
</section>

<section>
<title>postmaster</title>
<para>
Cleanup at 00:10 of all unprocessed emails which are received via procmail.
<programlisting>
10 0 * * * $HOME/bin/otrs.cleanup >> /dev/null
</programlisting>
</para>
</section>

<section>
<title>postmaster_pop3</title>
<para>
Fetch emails via PostMasterPOP3.pl every 10 minutes.
<programlisting>
*/10 * * * * $HOME/bin/PostMasterPOP3.pl >> /dev/null
</programlisting>
</para>
</section>
<section>
<title>unlock</title>
<para>
Unlock every hour old locked tickets.
<programlisting>
35 * * * * $HOME/bin/UnlockTickets.pl --timeout >> /dev/null
</programlisting>
</para>
</section>

<section>
<title>session</title>
<para>
Delete every six hours old session ids from database, filesystem or RAM.
<programlisting>
55 */6 * * * $HOME/bin/DeleteSessionIDs.pl --expired >> /dev/null
</programlisting>
</para>
</section>

<section>
<title>rebuild_ticket_index</title>
<para>
Rebuild of ticket index every day (needed for 
Kernel::System::Ticket::IndexAccelerator::StaticDB - see also chapter "Performance Tuning").
<programlisting>
01 01 * * * $HOME/bin/RebuildTicketIndex.pl >> /dev/null
</programlisting>
</para>
</section>

<section>
<title>generic_agent-database</title>
<para>
Execute GenericAgent.pl with database jobs every 10 minutes (see also chapter "Generic-Agent").
<programlisting>
*/10 * * * * $HOME/bin/GenericAgent.pl -c db >> /dev/null
</programlisting>
</para>
</section>

<section>
<title>generic_agent</title>
<para>
Execute GenericAgent.pl with Kernel/Config/GenericAgent.pm config file every 20 minutes (see also chapter "Generic-Agent").
<programlisting>
*/20 * * * * $HOME/bin/GenericAgent.pl >> /dev/null
</programlisting>
</para>
</section>

</section>

</chapter>
