Recebimento de email automático no OTRS
Recebimento de email automático no OTRS
1- Vamos entrar na pasta cron do OTRS:
#cd /opt/otrs/var/cron
2 - Vamos listar os arquivos para ver se os scripts estão dentro da pasta:
#ls
deverá aparecer os seguintes arquivos:
aaa_base.dist generic_agent.dist
rebuild_ticket_index.dist
cache.dist
pending_jobs.dist
session.dist
fetchmail.dist
postmaster.dist
unlock.dist
generic_agent-database.dist
postmaster_mailbox.dist
Pode variar de acordo com a versão do OTRS em uso.
3-Vamos copiar os arquivos utilizando o comando abaixo:
#for foo in *.dist; do cp $foo`basename $foo .dist`; done
Feito isso você terá os scripts como backup.
4- Instalação do Cron do OTRS: Vamos entrar na pasta bin:
#cd /opt/otrs/bin/
Logar como usuário otrs: #su otrs
Executar o script:
./Cron.sh start
Voltaremos a conta de root do sistema: exit
Feitas as configurações acima vamos instalar o Cron do OTRS:
#crontab -l -u otrs Deverá aparecer o texto conforme abaixo:
# --
# cron/aaa_base - base crontab package
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# Who gets the cron emails?
MAILTO="root@localhost"
# --
# cron/cache - delete expired cache
# Copyright (C) 2001-2011 OTRS AG, ttp://otrs.org/
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# delete expired cache weekly (Sunday mornings)
20 0 * * 0 $HOME/bin/otrs.CacheDelete.pl --expired >> /dev/null
30 0 * * 0 $HOME/bin/otrs.LoaderCache.pl -o delete >> /dev/null
# --
# cron/fetchmail - fetchmail cron of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# fetch every 5 minutes emails via fetchmail
#*/5 * * * * /usr/bin/fetchmail -a >> /dev/null
# --
# cron/generic_agent - otrs.GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# start generic agent every 20 minutes
*/20 * * * * $HOME/bin/GenericAgent.pl >> /dev/null
# example to execute GenericAgent.pl on 23:00 with
# Kernel::Config::GenericAgentMove job file
#0 23 * * * $HOME/bin/otrs.GenericAgent.pl -c "Kernel::Config::GenericAgentMove"
>>/dev/null
# --
# cron/generic_agent - GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# start generic agent every 10 minutes
*/10 * * * * $HOME/bin/otrs.GenericAgent.pl -c db >> /dev/null
# --
# cron/pending_jobs - pending_jobs cron of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# check every 120 min the pending jobs
45 */2 * * * $HOME/bin/otrs.PendingJobs.pl >> /dev/null
# --
# cron/postmaster - postmaster cron of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# check daily the spool directory of OTRS
#10 0 * * * * test -e /etc/init.d/otrs &
/etc/init.d/otrs cleanup >> /dev/null; test -e
/etc/rc.d/init.d/otrs && /etc/rc.d/init.d/otrs cleanup >> /dev/null
10 0 * * * $HOME/bin/otrs.CleanUp.pl >> /dev/null
# --
# cron/postmaster_mailbox - postmaster_mailbox cron of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# fetch emails every 10 minutes
*/10 * * * * $HOME/bin/otrs.PostMasterMailbox.pl >> /dev/null
# --
# cron/rebuild_ticket_index - rebuild ticket index for OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# just every day
01 01 * * *
$HOME/bin/otrs.RebuildTicketIndex.pl >> /dev/null
# --
# cron/session - delete old session ids of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# delete every 120 minutes old/idle session ids
55 */2 * * * $HOME/bin/otrs.DeleteSessionIDs.pl --expired >> /dev/null
# --
# cron/unlock - unlock old locked ticket of the OTRS
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY.
# --
# unlock every hour old locked tickets
35 * * * * $HOME/bin/otrs.UnlockTickets.pl --timeout >> /dev/null
Para alterar qualquer tarefa do cron basta entrar na pasta do OTRS, logar como usuário otrs e
editar o cron:
su otrs
crontab -e
Para configurar o email de envio e recebimento, entraremos no otrs e confiruraremos pelo modo gráfico:
Recebimento: admin > postMaster Mail Acounts > add mail acount > siga os passos do
seu servidor
Envio: Admin > Email > Add System Address.
Divirtam-se