2
这是我使用的命令调用:rsync命令失败时,通过系统()
rsync --partial --timeout=60 --rsh='/usr/bin/ssh -i /root/.ssh/id_rsa' /path/file [email protected]:/remote_path/
这时候我在命令行上运行它的工作原理,但是当我使用系统()不工作我的C程序。
更正:无论程序运行多长时间,启动后此调用都不起作用。如果程序重新启动,无论程序运行多少次,它都会工作。
status = system("rsync --partial --timeout=60 --rsh='/usr/bin/ssh -i /root/.ssh/id_rsa' /path/file [email protected]:/remote_path/");
rsync的返回值是12:rsync协议数据流中的错误。
也许你在运行调用system()的程序时有不同的工作目录? – 2011-05-18 18:14:03
对不起,我使用了一个绝对路径,而不是像我在示例中使用的本地路径。我会改变这一点。 (更改显示为使用) – Terminal 2011-05-18 18:18:59
与此类似的问题与PHP:http://stackoverflow.com/questions/5352194/solved-php-rsync-with-exec-not-working – Terminal 2011-05-18 18:25:20