Hi Maxim,

Welcome in the exciting world of unix administration ;-)

a. The cronjob should run under user www-data. Then there is no need to
'su'
b. perhaps it is because of e-mail, but it appears the script is on a
new line. In a 'crontab' you can _never_ use a new line (unless you
escape/end it with a "\")


For (a):
Either "sudo su - www-data"  and then "crontab -e" to edit, 
Or "sudo crontab -e -u ww-data" (edit as 'root' the user's crontab).

For (b): 
once editing, I suggest you fill it with all, or part of the attached
file.
The crucial part is:

  # fetch emails every 10 minutes
  */10 * * * *    $HOME/bin/PostMasterMailbox.pl >> /dev/null

$HOME suggests it is ranfrom 'otrs' user, so may need to be replaced
with the full path, in your case:

  # fetch emails every 10 minutes
  */10 * * * *    /usr/share/otrs/bin/PostMasterMailbox.pl >> /dev/null


Send us the output of

   sudo crontab -l -u www-data

to verify :-)


gr,
Frans

P.S.  /usr/share/otrs/var/cron hold the examples.
P.P.S. more tips on croin&ubuntu:
http://ubuntuforums.org/showthread.php?t=102626&highlight=cron



> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
Of
> maximx86
> Sent: vrijdag 1 mei 2009 15:40
> To: User questions and discussions about OTRS.
> Subject: Re: [otrs] error executing PostMasterMailbox.pl
> 
> Hi Michiel,
> 
> I am sorry I have to bore you again I am having problems with
> installing the conrjob for PostMasterMailbox.pl. I tried to get some
> help on different  forums to no avail.
> 
> So the command I run manually is:
> 
> sudo su - www-data
> cd /usr/share/otrs/bin
> ./PostMasterMailbox.pl
> 
> this works
> 
> the cronjob I tried
> */10 * * * * sudo su - www-data
> /usr/share/otrs/bin/PostMasterMailbox.pl >> /dev/null
> 
> I am being asked for the password and then I get
> 
> /usr/share/otrs/bin/PostMasterMailbox.pl: 23: use: not found
> /usr/share/otrs/bin/PostMasterMailbox.pl: 24: use: not found
> /usr/share/otrs/bin/PostMasterMailbox.pl: 27: use: not found
> /usr/share/otrs/bin/PostMasterMailbox.pl: 28: Syntax error: "("
> unexpected
> Press ENTER to continue and close this window.
> 
> I was told to try
> */1 * * * * www-data /usr/share/otrs/bin/PostMasterMailbox.pl >>
> /dev/null
> 
> still no luck
> 
> help please! :)
> 
> thank you
> 
> 
> On Wed, Apr 29, 2009 at 3:36 PM, Michiel Beijen <[email protected]>
> wrote:
> > So OK, here's the catch..
> >
> > I found out that the otrs2 package on Debian/Ubuntu uses the
www-data
> user
> > for this.
> > If you'd like to run PostMasterMailbox.pl by hand you'd use 'sudo su
> -
> > www-data'
> >
> > The cronjobs for OTRS are NOT installed after using the otrs2
> package;
> > please refer to:
> >
> > http://doc.otrs.org/2.3/en/html/x414.html#cronjobs
> >

# Who gets the cron emails?
MAILTO="r...@localhost"

# fetch every 5 minutes emails via fetchmail
#*/5 * * * * [ -x /usr/bin/fetchmail ] && /usr/bin/fetchmail -a >> /dev/null
#*/5 * * * *    /usr/bin/fetchmail -a --ssl >> /dev/null

# 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/GenericAgent.pl -c "Kernel::Config::GenericAgentMove" >> 
/dev/null

# start generic agent every 10 minutes
*/10 * * * *    $HOME/bin/GenericAgent.pl -c db >> /dev/null

# check every 120 min the pending jobs
45 */2 * * *    $HOME/bin/PendingJobs.pl >> /dev/null

# check daily the spool directory of OTRS
#10 0 * * * * [ -e /etc/init.d/otrs ] && /etc/init.d/otrs cleanup >> /dev/null; 
[ -e /etc/rc.d/init.d/otrs ] && /etc/rc.d/init.d/otrs cleanup >> /dev/null
10 0 * * *  $HOME/bin/otrs.cleanup >> /dev/null

# fetch emails every 10 minutes
*/10 * * * *    $HOME/bin/PostMasterMailbox.pl >> /dev/null

# just every day
01 01 * * * $HOME/bin/RebuildTicketIndex.pl >> /dev/null

# delete every 120 minutes old/idle session ids
55 */2 * * *    $HOME/bin/DeleteSessionIDs.pl --expired >> /dev/null

# unlock every hour old locked tickets
35 * * * *  $HOME/bin/UnlockTickets.pl --timeout >> /dev/null
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW!
http://www.otrs.com/en/support/enterprise-subscription/

Reply via email to