Re: DOS box, scheduled tasks, PHP script
| From: | DL Neil | Date: | Wed, 06 Feb 2002 16:29:17 +0000 |
| Subject: | Re: DOS box, scheduled tasks, PHP script | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11875@lists.php.net to get a copy of this message | ||
Thank you Pac mon, the idea of running the scheduled tasks under a different userId (to the console
operator)
certainly does stop the 'DOS box' (console window) putting in uninvited appearance. Neat
thinking!
Many thanks to all who contributed suggestions.
Mike: if PHP is run directly (as per the Scheduled Task Wizard) a 'DOS box' still fires up
- unless presumably
one uses Pac mon's technique, ie it is not the batch file that causes the DOS box/console
window to pop up.
The reason for the batch file is because there is a series of dependent tasks - the second must not
start until
the first has (successfully) completed, etc - and thus they are in a single batch/command file,
rather than
(say) a series of scheduled tasks (with individual command lines).
Alan: search.microsoft.com seems packed with helpful advice on programming such things (MSDN) -
which one has to
wade through before coming across a simple 'how to use from Win Explorer'. I didn't
want to have to write a
whole routine to use something I figured should be staring me in the face from the GUI. The whole
episode made
me think in terms of going 'back' to AT and NET commands...
Per your suggestion - and thoughts of similar switches when preparing .PIF files to run in the
background - I
was going round and round looking for what I figured would be a simple check box - but no...
So new answer to the FAQ: run PHP scripts from the command line/a batch file on a regular basis
using "Scheduled
Tasks" AND running under a dedicated background userId!
=dn
> You could run it as a different user.
> i.e. Create user tasker. Change the Task to logon to the tasker account.
> you will no longer see the window.
> >Have a 'monitoring' PHP command line script timed to run hourly.
> >Controlled by the new?IE5.5 Scheduled Tasks facility (as listed in Windows
> >Explorer - not quite the same as AT
> >(which is what I have used previously) )
> >Script is kicked off by a batch file.
> >Batch file is object in scheduled tasks entry.
> >
> >When it fires, a DOS box opens, the batch file is executed, PHP kicks in;
> >and upon completion, breaks down in
> >the reverse sequence.
> >Works perfectly but...
> >
> >How can one achieve this in the background - without popping up a DOS box
> >over the top of whatever else is
> >happening?
> >(and annoying the socks off an admin killing a printer/adding new users,
> >etc)
> >
> >Please advise,
> >=dn
> >
> >WinNT4.0 SP6a, IE5.5 SP2, PHP vn 4.0.6, Apache vn 1.3.20WinNT, MySQL vn
> >3.23.40-nt