Following boxes are running:

server1 (win2000), not allowed to use a web-server on it, only port 22(ssh)
is open to internet
server2 (unix) has apache and php, only port 22 and 80 are open to internet

I have to write a php-daemon on server1, which should simulate a
database-trigger. Every 5 min. I have to check a table in my database if
there are new rows, write the data in these new rows in a file and send the
file from server1 to server2 using ssh. After this I have to start a
php-script on server2. Javascript is not allowed.

My first release works fine, but some problems exist like following:

1. I use "at" command on server1 to start the script every 5 minutes. I
start "explorer myscript.php". I have to use explorer because I use the the
"header("Location:...)" php-function. But I don't want to use any web
servers. If I would use php.exe to start my script the "header" function
doesn't work because php.exe cannot understand header-data or any other
"meta" tags. My Question is: How can I start from server1 a php-script on
server2  using only php.exe without any browser or web server on server1?

2. I dont't want to use "at" command because this daemon should work on
every plattform without using any operating system functions. So I want to
start a php-script which runs forever without stopping. Which values for
timeout are necessary in php.ini ? Besides, if I use a never ending
"for(...)" command in my script it causes a 100% CPU-Using so other tasks
are pretty slow. I need a php-function like "wait" or "pause" but could not
find any. I need the following:
  for (;;)
   {
   wait for 5 sec;
   do something;
   }

3. I use "scp" (secure copy on port 22) for sending my file to server2. On
win2000 I use pscp(putty). pscp supports password in the commandline as a
parameter, but scp doesn't support this. So if I have a unix-box running my
daemon, it would ask me for password, but no one wants to type the password
every 5 min :)
Is there a way to send data on port 22 (ssh) without using os functions like
scp or pscp?
(I have no security problems with using password in my script on
server1(win2000), because the box is first behind real walls and second
behind a well working openbsd-firewall)

thanx for any hints or links, or maybe other ways to solve this problem.

ergin



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

Reply via email to