我创建了一个WinSCP脚本,用于将文本文件从SQL服务器发送到Raspberry Pi,后者在屏幕上显示数据。该文件每隔一分钟更新并使用此文件批量发送一次(重命名一些标识文本):
"C:\Program Files (x86)\WinSCP\WinSCP.com"
/log=C:\localfilepath\send_file_log.log
-command "option batch on" "option confirm off" "open sftp://user:pass@XXX.XXX.XXX.250:22 -hostkey=*"
"put C:\localfilepath\SQL_results_2.txt /remotefilepath/SQL_results.txt" "close" "exit"
这几天工作正常,但突然间它停止工作,我没有改变任何东西,因为我设置它运行几天。它仍然成功上传文件,但文件完全空白。它在命令提示符或WinSCP日志文件中运行时不会产生任何错误消息。
我已经尝试通过chmod将文件的权限设置为0777,并且问题仍然存在,因此它不是该类型的权限问题。我也尝试重新启动Pi,以防万一。
什么可能导致上传的文件为空?
编辑:我似乎无法通过WinSCP GUI编辑文件,我将编辑文件并保存,但没有任何更改生效。好像它可能不是WinSCP问题,所以我会进一步研究。
编辑2:问题已解决。事实证明这是一个空间问题,如评论中所建议的那样。对这个愚蠢的问题道歉。
下面的WinSCP日志文件内容:
. 2018-01-02 08:57:57.327 --------------------------------------------------------------------------
. 2018-01-02 08:57:57.328 WinSCP Version 5.7.5 (Build 5665) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Standard)
. 2018-01-02 08:57:57.328 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2018-01-02 08:57:57.328 Log level: Normal
. 2018-01-02 08:57:57.328 Local account: DOMAIN\USER
. 2018-01-02 08:57:57.328 Working directory: C:\localfilepath
. 2018-01-02 08:57:57.328 Process ID: 31624
. 2018-01-02 08:57:57.328 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=575 /consoleinstance=_64720_717 "/log=C:\localfilepath\send_file_log.log" "-command" "option batch on" "option confirm off" "open sftp://user:pass@XXX.XXX.XXX.250:22 -hostkey=*" "put C:\localfilepath\SQL_results_2.txt /remotefilepath/SQL_results.txt" "close" "exit"
. 2018-01-02 08:57:57.329 Time zone: Current: GMT-7, Standard: GMT-7 (Mountain Standard Time), DST: GMT-6 (Mountain Daylight Time), DST Start: 3/11/2018, DST End: 11/4/2018
. 2018-01-02 08:57:57.329 Login time: Tuesday, January 02, 2018 8:57:57 AM
. 2018-01-02 08:57:57.329 --------------------------------------------------------------------------
. 2018-01-02 08:57:57.329 Script: Retrospectively logging previous script records:
> 2018-01-02 08:57:57.329 Script: option batch on
< 2018-01-02 08:57:57.329 Script: batch on
< 2018-01-02 08:57:57.329 Script: reconnecttime 120
> 2018-01-02 08:57:57.329 Script: option confirm off
< 2018-01-02 08:57:57.329 Script: confirm off
> 2018-01-02 08:57:57.329 Script: open sftp://user:***@XXX.XXX.XXX.250:22 -hostkey=*
. 2018-01-02 08:57:57.329 --------------------------------------------------------------------------
. 2018-01-02 08:57:57.329 Session name: user@XXX.XXX.XXX.250 (Ad-Hoc site)
. 2018-01-02 08:57:57.329 Host name: XXX.XXX.XXX.250 (Port: 22)
. 2018-01-02 08:57:57.329 User name: user (Password: Yes, Key file: No)
. 2018-01-02 08:57:57.329 Tunnel: No
. 2018-01-02 08:57:57.329 Transfer Protocol: SFTP
. 2018-01-02 08:57:57.329 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2018-01-02 08:57:57.329 Disable Nagle: No
. 2018-01-02 08:57:57.329 Proxy: none
. 2018-01-02 08:57:57.329 Send buffer: 262144
. 2018-01-02 08:57:57.329 SSH protocol version: 2; Compression: No
. 2018-01-02 08:57:57.329 Bypass authentication: No
. 2018-01-02 08:57:57.329 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2018-01-02 08:57:57.329 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2018-01-02 08:57:57.329 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2018-01-02 08:57:57.329 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2018-01-02 08:57:57.329 Simple channel: Yes
. 2018-01-02 08:57:57.329 Return code variable: Autodetect; Lookup user groups: A
. 2018-01-02 08:57:57.330 Shell: default
. 2018-01-02 08:57:57.330 EOL: 0, UTF: 2
. 2018-01-02 08:57:57.330 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2018-01-02 08:57:57.330 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2018-01-02 08:57:57.330 SFTP Bugs: A,A
. 2018-01-02 08:57:57.330 SFTP Server: default
. 2018-01-02 08:57:57.330 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2018-01-02 08:57:57.330 Cache directory changes: Yes, Permanent: Yes
. 2018-01-02 08:57:57.330 DST mode: 1
. 2018-01-02 08:57:57.330 --------------------------------------------------------------------------
. 2018-01-02 08:57:57.331 Looking up host "XXX.XXX.XXX.250"
. 2018-01-02 08:57:57.331 Connecting to XXX.XXX.XXX.250 port 22
. 2018-01-02 08:57:57.458 Server version: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u6
. 2018-01-02 08:57:57.458 Using SSH protocol version 2
. 2018-01-02 08:57:57.459 We claim version: SSH-2.0-WinSCP_release_5.7.5
. 2018-01-02 08:57:57.475 Doing Diffie-Hellman group exchange
. 2018-01-02 08:57:57.546 Doing Diffie-Hellman key exchange with hash SHA-256
. 2018-01-02 08:57:59.941 Verifying host key rsa2 **************************************
. 2018-01-02 08:57:59.942 Host key matches cached key
. 2018-01-02 08:57:59.942 Host key fingerprint is:
. 2018-01-02 08:57:59.942 ssh-rsa 2048 ***********************************
. 2018-01-02 08:57:59.943 Initialised AES-256 SDCTR client->server encryption
. 2018-01-02 08:57:59.943 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2018-01-02 08:57:59.943 Initialised AES-256 SDCTR server->client encryption
. 2018-01-02 08:57:59.943 Initialised HMAC-SHA-256 server->client MAC algorithm
! 2018-01-02 08:57:59.954 Using username "user".
. 2018-01-02 08:58:04.971 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2018-01-02 08:58:04.971 Using stored password.
. 2018-01-02 08:58:04.972 Sent password
. 2018-01-02 08:58:05.197 Access granted
. 2018-01-02 08:58:05.197 Opening session as main channel
. 2018-01-02 08:58:05.208 Opened main channel
. 2018-01-02 08:58:05.272 Started a shell/command
. 2018-01-02 08:58:05.273 --------------------------------------------------------------------------
. 2018-01-02 08:58:05.273 Using SFTP protocol.
. 2018-01-02 08:58:05.274 Doing startup conversation with host.
> 2018-01-02 08:58:05.274 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2018-01-02 08:58:05.294 Type: SSH_FXP_VERSION, Size: 124, Number: -1
. 2018-01-02 08:58:05.295 SFTP version 3 negotiated.
. 2018-01-02 08:58:05.295 Unknown server extension posix-rename@openssh.com="1"
. 2018-01-02 08:58:05.295 Supports statvfs@openssh.com extension version "2"
. 2018-01-02 08:58:05.295 Unknown server extension fstatvfs@openssh.com="2"
. 2018-01-02 08:58:05.295 Supports hardlink@openssh.com extension version "1"
. 2018-01-02 08:58:05.295 We believe the server has signed timestamps bug
. 2018-01-02 08:58:05.295 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
. 2018-01-02 08:58:05.295 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2018-01-02 08:58:05.295 Getting current directory name.
. 2018-01-02 08:58:05.295 Getting real path for '.'
> 2018-01-02 08:58:05.295 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2018-01-02 08:58:05.325 Type: SSH_FXP_NAME, Size: 37, Number: 16
. 2018-01-02 08:58:05.325 Real path is '/home/user'
. 2018-01-02 08:58:05.325 Startup conversation with host finished.
< 2018-01-02 08:58:05.326 Script: Active session: [1] user@XXX.XXX.XXX.250
> 2018-01-02 08:58:05.326 Script: put C:\localfilepath\SQL_results_2.txt /remotefilepath/SQL_results.txt
. 2018-01-02 08:58:05.327 Copying 1 files/directories to remote directory "/remotefilepath/"
. 2018-01-02 08:58:05.327 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: SQL_results.txt
. 2018-01-02 08:58:05.327 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2018-01-02 08:58:05.327 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2018-01-02 08:58:05.328 File: 'C:\localfilepath\SQL_results_2.txt' [2018-01-02T15:40:55.783Z] [492]
. 2018-01-02 08:58:05.328 Copying "C:\localfilepath\SQL_results_2.txt" to remote directory started.
. 2018-01-02 08:58:05.328 Binary transfer mode selected.
. 2018-01-02 08:58:05.329 Opening remote file.
> 2018-01-02 08:58:05.329 Type: SSH_FXP_OPEN, Size: 94, Number: 259
< 2018-01-02 08:58:05.362 Type: SSH_FXP_HANDLE, Size: 13, Number: 259
> 2018-01-02 08:58:05.363 Type: SSH_FXP_WRITE, Size: 517, Number: 774
> 2018-01-02 08:58:05.365 Type: SSH_FXP_CLOSE, Size: 13, Number: 1028
> 2018-01-02 08:58:05.365 Type: SSH_FXP_SETSTAT, Size: 90, Number: 521
< 2018-01-02 08:58:05.417 Type: SSH_FXP_STATUS, Size: 24, Number: 774
< 2018-01-02 08:58:05.465 Type: SSH_FXP_STATUS, Size: 24, Number: 1028
< 2018-01-02 08:58:05.465 Status code: 0
. 2018-01-02 08:58:05.465 Preserving timestamp [2018-01-02T15:40:55.000Z]
< 2018-01-02 08:58:05.465 Type: SSH_FXP_STATUS, Size: 24, Number: 521
< 2018-01-02 08:58:05.465 Status code: 0
. 2018-01-02 08:58:05.465 Transfer done: 'C:\localfilepath\SQL_results_2.txt' [492]
> 2018-01-02 08:58:05.465 Script: close
. 2018-01-02 08:58:05.465 Closing connection.
. 2018-01-02 08:58:05.465 Sending special code: 12
. 2018-01-02 08:58:05.466 Sent EOF message