Skip to content

自动检测ionet状态并重启。如果觉得好用,记得给个star哦

Notifications You must be signed in to change notification settings

hbnnwwt/ionet_restart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

监控并重启IONET脚本

1.进入wsl

先获得root权限 然后

su

在Password:输入root密码

2.创建脚本。

创建一个脚本,从网站 https://cloud.io.net/worker/devices 获取你的数据device_id、user_id、device_name,填入下边代码里

cat > /root/check_ionet.sh <<EOF 
#!/bin/bash
device_id="Yours device_id"#替换成你的
user_id="Yours user_id"#替换成你的
device_name="Yours device_name"#替换成你的
system=linux #linux or mac
gpu=false #false or true
if [[ "$system" == "linux" ]]; then
    os="Linux"
elif [[ "$system" == "mac" ]]; then
    os="macOS"
if [[ $(docker ps | grep -c "io-worker-monitor") -eq 1 && $(docker ps | grep -c "io-worker-vc") -eq 1 ]]; then
    echo "NODE IS WORKING"
else
    echo "STOP AND DELETE ALL CONTAINERS"
    docker rm -f $(docker ps -aq) && docker rmi -f $(docker images -q) 
    yes | docker system prune -a
    echo "DOWNLOAD FILES FOR $os"
    rm -rf launch_binary_$system && rm -rf ionet_device_cache.txt
    curl -L https://github.com/ionet-official/io_launch_binaries/raw/main/launch_binary_$system -o launch_binary_$system
    chmod +x launch_binary_$system
    echo "START NEW NODE"
    /root/launch_binary_$system --device_id=$device_id --user_id=$user_id --operating_system="$os" --usegpus=$gpu --device_name=$device_name
fi
EOF

复制上述代码,把device_id、user_id、device_name替换成你的之后,直接粘贴到命令行。这三个内容,从下图对应位置代码里可以找到。

image

3.修改脚本权限

chmod +x /root/check_ionet.sh

4.可以先运行一下,可以看到脚本正在运行。

/root/check_ionet.sh
image

5.将脚本加入到定时运行。

crontab<<EOF
HOME=/root/
*/5 * * * * check_ionet.sh
EOF

About

自动检测ionet状态并重启。如果觉得好用,记得给个star哦

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages