woff 發表於 2022-3-29 15:42:25

ubuntu LINUX 排程 及 回報

進入SUDO後

k3s=0
netstat -tunlp | grep k3s|cut -d"/" -f 2|cut -d" " -f 1 > /root/k3s.txt
while read line; do
k3s=$((k3s+1))
done < /root/k3s.txt
hdd=$(df -h | grep /mnt/qlv2|cut -d"/" -f 3|awk '{print $2}')
save=$(df -h | grep /mnt/qlv2|cut -d"/" -f 3|awk '{print $3}')
node=0
cat /var/lib/rancher/k3s/agent/containerd/containerd.log | tail -5 |grep piping | awk '{print $4}' > /root/node.txt
while read line; do
node=$((node+1))
done < /root/node.txt
ram=$(grep -E 'MemTotal' /proc/meminfo | awk '{print $2/1024/1024+1 "GB"}')
days=$(/opt/qlauncherV3/qlauncher status |grep 'ipfs'|head -n 1 |awk '{print $3 $4}')
curl "https://miner.netyea.com/vminfo.php?vmname=VMx&vmip=$(curl ident.me)&k3s=$k3s&hdd=$hdd&save=$save&node=$node&ram=$ram&days=$days"

VMx改成你的主機暱稱


存檔離開

讓檔案可以執行
chmod 777 /root/callback.sh

排程
crontab -e寫入
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
*/10 * * * * /root/callback.sh

加入環境變數
每十分鐘回報一次





頁: [1]
查看完整版本: ubuntu LINUX 排程 及 回報