因而去分析 ，脚本中有一条 aws s3 sync $srclocal $dsts3 命令，而后根据这条命令的执行状态码判断成功与失败缓存
难道是部分文件备份失败，因而加入调试信息，输出stderr信息及exit code，最后return code 为 2 socket
最后，去查询了一下，aws cli相关的文档，AWS CLI Return Codes， 有一段说明以下：ui
These are the following return codes returned at the end of execution of a CLI command: 0 -- The service responded with an HTTP response status code of 200 and there were no errors from either the CLI or the service the request was made to. 1 -- Limited to s3 commands, at least one or more s3 transfers failed for the command executed. 2 -- The meaning of this return code depends on the command being run. The primary meaning is that the command entered on the command line failed to be parsed. Parsing failures can be caused by, but are not limited to, missing any required subcommands or arguments or using any unknown commands or arguments. Note that this return code meaning is applicable to all CLI commands. The other meaning is only applicable to s3 commands. It can mean at least one or more files marked for transfer were skipped during the transfer process. However, all other files marked for transfer were successfully transferred. Files that are skipped during the transfer process include: files that do not exist, files that are character special devices,block special device, FIFO's, or sockets, and files that the user cannot read from. 130 -- The process received a SIGINT (Ctrl-C). 255 -- Command failed. There were errors from either the CLI or the service the request was made to.
[qq_5201351@localhost tmp]$ cat Project_s3sync_stderr.log warning: Skipping file /backup/db-backup.20211108.tar. File/Directory is not readable.
另：在生产环境中，笔者还会遇到exit code 为1的状况，查询日志以下：日志
upload failed: ../../dir/.log.16 to s3://qq5201351/.log.16 [Errno 2] No such file or directory: '/dir/.log.16'