先获得root权限 然后
su
在Password:输入root密码
创建一个脚本,从网站 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替换成你的之后,直接粘贴到命令行。这三个内容,从下图对应位置代码里可以找到。
chmod +x /root/check_ionet.sh
/root/check_ionet.sh
crontab<<EOF
HOME=/root/
*/5 * * * * check_ionet.sh
EOF