running commands sequentially in background with exec($commands_in_background)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux