You are here: running commands sequentially in background with exec($commands_in_background) « All PHP « IT news, forums, messages
running commands sequentially in background with exec($commands_in_background)

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация