差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
it:server:file_sync [2021-07-31 06:00] – [rsync 监控目录并同步] goldentianya | it:server:file_sync [2022-08-29 18:45] (当前版本) – goldentianya | ||
---|---|---|---|
行 2: | 行 2: | ||
==== rsync 监控目录并同步 ==== | ==== rsync 监控目录并同步 ==== | ||
+ | |||
+ | [[https:// | ||
[[https:// | [[https:// | ||
行 16: | 行 18: | ||
tar -zcvf aliyun.tar.gz --exclude " | tar -zcvf aliyun.tar.gz --exclude " | ||
# 如果不想保护目录,需要进入到文件夹内进行压缩 | # 如果不想保护目录,需要进入到文件夹内进行压缩 | ||
+ | tar -xzf aliyun.tar.gz | ||
</ | </ | ||
+ | |||
+ | **增量备份** | ||
+ | < | ||
+ | $ rsync -a --delete --link-dest / | ||
+ | </ | ||
+ | |||
+ | 上面命令中,--link-dest参数指定基准目录/ | ||
+ | |||
==== scp 脚本命令 ==== | ==== scp 脚本命令 ==== | ||
< | < | ||
scp -r ./libs ./resources ./dist ./*.js ./*.json [email protected]:/ | scp -r ./libs ./resources ./dist ./*.js ./*.json [email protected]:/ | ||
+ | |||
+ | # scp -P < | ||
</ | </ | ||
行 27: | 行 40: | ||
[[http:// | [[http:// | ||
< | < | ||
- | + | apt-get | |
- | yum install -y expect | + | |
</ | </ | ||
脚本 " | 脚本 " | ||
- | < | + | <file dodeploy.sh> |
# | # | ||
spawn scp -r ./libs ./resources ./dist index.js app.js jobs.js package.json < | spawn scp -r ./libs ./resources ./dist index.js app.js jobs.js package.json < | ||
行 46: | 行 57: | ||
然后执行脚本文件 '' | 然后执行脚本文件 '' | ||
+ | 如果希望执行以后继续留在进程内,比如 “su -” 更换root用户,需要将 exp_continue 换成 <color # | ||
{{tag> | {{tag> |