判断文件不同则自动更新程序
🕤 by pyList at 2019-01-13 20:37
在开放中,如果需要在服务器上调试,则需要一个自动更新的脚本,自动覆盖、重启服务
判断两个文件是否相同:
使用 cmp
是最简单且高效的方法
cmp --silent $old $new || echo "files are different"
也可以使用md5:
#!/bin/bash
file1=`md5sum $1`
file2=`md5sum $2`
if [ "$file1" = "$file2" ]
then
echo "Files have the same content"
else
echo "Files have NOT the same content"
fi
写一个定时循环任务,一分钟实行一次:
* * * * * (cmp --silent newfile oldfile || cp -f newfile oldfile && supervisorctl restart app1)
#!/bin/bash
cmp -s filename_1 filename_2 > /dev/null
if [ $? -eq 1 ]; then
echo is different
else
echo is not different
fi
本文网址: https://pylist.com/t/1547383052 (转载注明出处)
如果你有任何建议或疑问可以在下面 留言
发表第一条评论!
相关推荐
小工具
标签
python
md5
正确
文件
计算
nginx
上传
服务器
中断
时间
判断
当前
是否
文件类型
magic
从文件
wkwebview
ios
载入
灵活
golang
tornado
缓存
禁用
静态
路径
获取
运行
几种
部署
方案
不同
自动更新
microsoft
mac
关闭
cpu
debian
ubuntu
查看
温度
正则
字符串
切割
硬件加速
ubnt
er
固件
路由
变砖
arris
ac1750
sbr
bbr
openwrt
开启
访问速度
vps
加速
google
身份验证
authenticator
迁移
手机
静音
风扇
主机
笔记本
改造
之坑
files
open
服务
最新版
wndr4300
升级
默认值
struct
设置
html
中文
实体
转换
api
搜索引擎
网址
提交
自动
虚拟机
virtualbox
很慢
网络
解决
ssdb
数据库
设计
结构
usb
上网卡
共享
app
store
登录
未知
低功耗
web
爬虫
组装
微信
尝鲜
视频
体验
chrome
server
浏览
webdriver
微博
selenium
gnu
linux
安装
系统启动
编译
宅家
坑记
屏幕
动手
quic
抢先
useragent
蜘蛛
真假
识别
最近发表
- Mac 关闭 Microsoft 自动更新
- Mac 登录 App Store 出现“发生了未知错误”的解决方法
- 老笔记本改造为无风扇静音主机方案
- 自己组装21瓦低功耗家庭爬虫、文件、web服务器
- 微信视频号尝鲜体验
- Ubuntu/Debian 查看CPU温度的方法
- 在Ubuntu/debian Server 系统使用Chrome 无头浏览模式
- 换手机后 Google 身份验证器 Google Authenticator 数据迁移的简单方法
- 使用Golang selenium WebDriver 自动登录微博
- 在 Ubuntu 或其它 GNU/Linux 系统下安装 Debian
- Mac 下制作 USB ubuntu/debian 系统启动、安装盘的几种方法
- ubuntu/debian 下自行编译 OpenWRT 固件
- 宅家自己动手换手机屏幕掉坑记
- 路由 UBNT ER-X 官方固件升级及开启硬件加速的方法
- 在 Nginx 和 Golang web 上抢先体验 QUIC
- 从UserAgent识别搜索引擎并判断真假蜘蛛
最近浏览
- Ubuntu/Debian 查看CPU温度的方法
- Golang 正则切割字符串
- 路由 UBNT ER-X 官方固件升级及开启硬件加速的方法
- ARRIS SBR-AC1750 路由变砖拆解折腾
- Openwrt 路由上开启BBR
- 开启BBR 加速小VPS访问速度
- 换手机后 Google 身份验证器 Google Authenticator 数据迁移的简单方法
- 老笔记本改造为无风扇静音主机方案
- Golang 服务之坑:too many open files
- WNDR4300 固件升级到 OpenWrt 最新版
- go struct 设置默认值
- 用python 实现中文与html实体相互转换
- 利用 API 自动向搜索引擎提交网址
- VirtualBox 虚拟机里网络很慢的解决方法
- SSDB如何设计数据库结构?
- Openwrt 使用USB 4G 上网卡共享网络