python 脚本实现定时重启Linux 系统

内容如下

touch reboot.py

···
#!/usr/bin/env python

        from os import system

        from time import sleep

        sleep(60)
        system('echo"这是服务器用户密码"|reboot')

···

把写好的脚本copy 到开启动下面

···
sudo cp -rf reboot.py /etc/init.d
sudo update-rc.d reboot.py default 90
···

在重启服务器

posted @ 2019-02-21 19:28  信念&坚持✊  阅读(1015)  评论(0编辑  收藏  举报