You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
983 B
46 lines
983 B
#! /bin/bash
|
|
# 监视目录
|
|
webroot="/root/demo"
|
|
|
|
|
|
cp /dev/null rsync_file
|
|
# 判断是否存在
|
|
if [ !-f file.x01 ];then
|
|
find $webroot -type f -exec md5sum {} \; >>file.x01
|
|
else
|
|
# 新文件
|
|
for newfile in $(find $webroot -type f)
|
|
do
|
|
grep $newfile file.x01 >/dev/null 2>&1
|
|
if [ $? -gt 0 ];then
|
|
mdval = $(md5sum $newfile)
|
|
# mdval = md5sum $newfile >> file.md5
|
|
# 拼装POST json
|
|
# ret = curl --location 'http://192.168.66.180/api/notify' --header 'Content-Type:application/json' -data '{"filename":"$newfile","filehash":"$mdval"}'
|
|
|
|
# echo "$newfile"
|
|
echo "$ret\r\n"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
|
|
#!/bin/bash
|
|
|
|
A="a a"
|
|
B="bb"
|
|
|
|
read -r -d '' PAYLOAD <<-EOM
|
|
{
|
|
"A": "${A}",
|
|
"B": "${B}"
|
|
}
|
|
EOM
|
|
|
|
#PAYLOAD=$(echo $PAYLOAD | jq -c .)
|
|
PAYLOAD=$(jq -c . <<<${PAYLOAD})
|
|
|
|
|
|
CMD="curl --noproxy '*' -d '${PAYLOAD}' http://localhost:8080/path/url"
|
|
echo ${CMD}
|
|
eval ${CMD}
|