Create a file on on the origin server and use the –files-from option
rsync -anvi --files-from=/tmp/only_these_files . to-server:/
This could be specific to the PHP package from Ubuntu. Please consider the following a disclaimer.
$ php -v
PHP 5.3.5-1ubuntu7.2 with Suhosin-Patch (cli) (built: May 2 2011 23:00:17)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
$ cat /etc/lsb-release
I have a file with the following contents:
$ cat stdin.php
echo microtime(), "n";
and I was doing something like this (backgrounds the script. I was using a slightly modified version to make concurrent SOAP requests)
$ for i in `seq 1 2`; do echo $i; sleep 2s; php /tmp/stdin.php >> /tmp/k7.out & done
- Stopped php /tmp/stdin.php >> /tmp/k7.out
+ Stopped php /tmp/stdin.php >> /tmp/k7.out
There are a few threads on the Internet relating to the issue and there are a few solutions.
First let us kill the ‘STOPPED’ jobs
$ kill %1
$ kill %2
 Terminated php /tmp/stdin.php >> /tmp/k7.out
+ Terminated php /tmp/stdin.php >> /tmp/k7.out
One of the solutions that worked for me was by supplying something to STDIN (perhaps STDIN was blocking, but then again, stream_set_blocking (STDIN, 0) wasn’t of much help).
$ for i in `seq 1 2`; do echo $i; sleep 2s; php /tmp/stdin.php >> /tmp/k7.out < /dev/null & done
and you could simulate arguments
$ for i in `seq 1 2`; do echo $i; sleep 2s; echo arg1 arg2 | php /tmp/stdin.php >> /tmp/k7.out & done
$ tail -f k7.out
I had a few cron entries that did not run and for a long a time I had no idea why.
I had the MAILTO variable set at the top of the crontab and I was expecting to be mailed the output of the cron entries. I was surprised when that did not happen. Looking at the mail.err log I came to know that my ssmtp setup was not working as I could see a few entries like this:
Jan 19 09:48:52 localhost sSMTP: RCPT TO:<testing ssmtp setup@> (553 5.1.2 or other punctuation after the recipient's email address. o1sm8676654wfl.14)
I had gmail setup using ssmtp and the settings seemed to be right. After doing some research I decided to install the ‘mailx’ package and that solved the mail issue and I started receiving the errors from the crontab.
The errors were indicating that the commands in the crontab had a few syntax errors but, they ran fine when I copied and pasted them into my shell and hit enter. After some trial and error I figured out the piece of code that was triggering the error to be something like this:
I immediately put those into a shell script and used that in the crontab. That did the trick and my cron jobs were running smoothly. I was not too happy with the solution and continued investigating. One of the error messages:
/bin/sh: Syntax error: EOF in backquote substitution
led me to a solution. It turns out that ‘%’ character in my crontab entry was the source of trouble and it had to be escaped as mentioned in the manpage:
Percent-signs (%) in the command, unless
escaped with backslash (), will be changed into newline characters, and
all data after the first % will be sent to the command as standard input.
So, my modified command looked like this:
And all was good from there.
Also, please remember to save and quit the editor used to edit crontab entries for the new/updated entries to be installed(that’s what happened when my editor was vim).
echo "hello there." | grep -o "ello t"
The flag ‘o’ (not Zero) does the trick.
From the man page:
Show only the part of a matching line that matches PATTERN.
I couldn’t find that flag as an option in the BSD Grep man page. So this might only be available with GNU version of Grep.