admin管理员组

文章数量:1560822

1>forever shell code:


#!/bin/bash

current_dir=$(pwd)
python3dir=$(which python3) 

mainfile=main.py

echo $current_dir
echo $script_dir
echo $python3dir
echo "$python3dir $current_dir/$mainfile;"

until $python3dir $current_dir/$mainfile; do
    echo "Server $mainfile  crashed with exit code $?.  Respawning.." >&2
    sleep 5
done

2>scp 用法


1、从远程复制文件到本地目录。

scp root@192.168.50.10:/home/ray/test.py  /home/pi/

 

2、从远程复制目录到本地目录。

scp -r root@192.168.50.10:/home/ray/test-prj  /home/pi/

 

3、上传本地文件到远程目录。

scp /home/ray/test-prj.tar.gz  pi@192.168.50.98:/home/pi/
 

4、上传本地目录到远程目录。

scp -r 
/home/ray/test-prj pi@192.168.50.98:/home/pi/





本文标签: 重启脚本自动重启Shell