Posted by Dasdan on 07/28/06 10:51
I want to execute a couple of linux commands from a php script
'sequentially in background'.
I want to run them in background so the php script doesn't hang while
the linux commands are running.
example:
first i create a lock file with php
$lockfile_path : home/web...blablabla.../test.tar.bz2_Lock.txt
the I execute the following command from my php script:
exec("du -a ~/ 2>&1 > home/web...blablabla.../backupFSlog.txt ;
sleep 10 >/dev/null 1>/dev/null 2>/dev/null ; rm -f $lockfile_path
>/dev/null 1>/dev/null 2>/dev/null &);
problem:
the php script hangs for 10 seconds (sleep), what is not what I want
I've read a lot of sugestions but I can't get it to work.
When I execute the commands one by one, it works in background, but
when I want to run them 'sequentially in background', the php script
hangs
They need to run sequentially because the $lockfile_path may only be
deleted when all the other commands are executed
Some advice please?
--
http://www.dasdan.be
[Back to original message]
|