Re: Calling script vs one-liner?

From: Lukas Jelinek <>
Date: Sat, 05 Feb 2011 17:53:30 +0100

I've already written about this issue many times. incron doesn't work
like a shell interpreter and thus it can't recognize shell syntax
including output redirection and so on. All the parameters given after
the program executable name are treated as program arguments. Therefore
no error is reported. Currently there is the only way how to use those
constructions like output redirection or pipes: to write a script. There
are some requirements for this such as #0000446 for the future versions
of incron but the more complex way described above must be used for now.


> I had a long query written up about trying to figure out why my table
> wasn't executing the script as I wanted, but eventually figured out
> that as an incron entry this does not work:
> /var/import/foo/file.txt IN_CLOSE_WRITE /usr/bin/php
> /usr/share/importer/run.php foo &> /var/import/foo/report.txt
> but if I have one-line bash script containing same, and have the
> incron entry:
> /var/import/foo/file.txt IN_CLOSE_WRITE /usr/share/importer/bash_script
> Then it works fine.
> This was found through trial and error, what was it about the previous
> entry that breaks?
> (The /var/log/cron file shows the one-liner running, no errors shown.)
> Regards,
> -Patrick Barnes
> --
> UTS CRICOS Provider Code: 00099F
> DISCLAIMER: This email message and any accompanying attachments may
> contain
> confidential information. If you are not the intended recipient, do not
> read, use, disseminate, distribute or copy this message or
> attachments. If
> you have received this message in error, please notify the sender
> immediately and delete this message. Any views expressed in this message
> are those of the individual sender, except where the sender expressly,
> and
> with authority, states them to be the views the University of Technology,
> Sydney. Before opening any attachments, please check them for viruses and
> defects.

*Ing. Lukás( Jelínek*
*AIKEN s.r.o.*
provozovna: Lorecká 465, 284 01 Kutná Hora
sídlo: Jakubská 3, 284 01 Kutná Hora
tel. 312 312 413
mobil 606 362 315
fax 910 807 336
e-mail: <>
Received on Tue Jun 05 2012 - 22:14:21 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 05 2012 - 22:14:21 CEST