When you need to sync to another machine when uploading files, you can perform a shell script for file synchronization.
#! /bin/basha=$1b=$2ip=$3port=$4passwd=$5/bin/rpm -qa|/bin/grep -q expectif-ne0 ];thenecho"please install expect"exitfiif$#-ne5 ];thenecho"must 5 parameter,1:source file,2:object file,3:object ip 4:object port,5:passwd"exitfi" spawn scp -P $port$a root@$ip:$b expect { \"*assword\" {set timeout 300; send \"$passwd\r\";} \"yes/no\" {send \"yes\r\"; exp_continue;} } expect eof"
Run scripts need to install expect, directly yum installation can
Expect script is a kind of script language based on TCL, the exposure rate is not high, but it is a good base friend of shell script. Expect scripts are interactive and designed for interactive applications, often in conjunction with Telnet, FTP, fsck, rlogin, Tip, SCP, and more
If the script edited from win appears under Linux no such file or directory, can be executed under Linux VI script
:sef ff=unix
When PHP executes the shell script, remember to write the absolute path
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the use of PHP call Shell script synchronization files, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.