Aschwin Wesselius wrote: > Rahul wrote: >> I have a small file to be transferred between two computers every few >> seconds. I'm using unix with a bare bones version of php, i.e. just >> the original thing that gets installed when I run "yum install php". >> As there is no webserver on any of these machines, I was wondering if >> there is a way to transfer a small file between them and if there is, >> could someone be kind enough to provide me with an example please? >> >> Thank You > > You can use netcat (nc), but that doesn't run in daemon mode. You can > use them both ways (client / server, sending / receiving). You can use > them on the commandline with a cronjob or whatever. > > Netcat makes it possible to do this, to send content over to port 2200 > of 192.168.1.1: > > cat textfile.txt | nc 192.168.1.1 2200 > > On 192.168.1.1 all you do is something like this: > > nc -l -p 2200 > textfile.txt > > I don't know all the options in depth and may not work like scp does > (which is way more secure). > > So I would go with scp in a cronjob, but netcat is still an option. > > Here's overkill: use "fuse" to make two sshfs filesystems :) # Make some directories to mount the remote stuff onto mkdir -p mount_point_for_B mkdir -p mount_point_for_C # Use 'fuse' to make SSHFS mounts from the remotes to the new directories sshfs B:/path_to_where_the_file_is mount_point_for_B sshfs C:/path_to_where_the_file_goes mount_point_for_C # Copy the file across: repeat this step every few seconds (cron job?) cp mount_point_for_B/the_file_to_copy mount_point_for_C # Unmount the SSHFS mounts when you're finished fusermount -u mount_point_for_B fusermount -u mount_point_for_C Still not PHP though... -- Peter Ford phone: 01580 893333 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php