NYCPHP Meetup

NYPHP.org

[nycphp-talk] best way to run script?

Chris Snyder chsnyder at gmail.com
Mon Jul 20 08:00:52 EDT 2009


On Mon, Jul 20, 2009 at 12:13 AM, Konstantin Rozinov<krozinov at gmail.com> wrote:
> Hey guys,
>
> I'm trying to run the same php script via the command line interface
> on several remote servers.
> I'd like to do it securely preferably over ssh.  Right now, I'm using
> the ssh2 class from php, but getting very inconsistent results
> (sometimes the script runs, sometimes it doesn't via ssh2_exec)
>
> What do people use to run scripts on production machines?
>
> Thanks,
> Konstantin

Cron?

If you need central command and control, as opposed to just running
the script periodically, you can still run it every 10 minutes or
something using cron, but have the script check in to a central
location via https to see what, if anything, it should do.

Also, you don't need to use the ssh class to use ssh. If your script
is interactive, you can use passthru() to execute command line ssh and
get control of password prompt and/or remote script. If not, use ssh
key authentication and exec().

Chris Snyder
http://chxor.chxo.com/



More information about the talk mailing list