根据进程名称查看进程

ps -ef | grep tomcat

查看当前路径

pwd

允许root用户登录ssh

sed -e "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" -i /etc/ssh/sshd_config
/etc/init.d/ssh restart

后台自动启动

cat >/etc/systemd/system/myscript.service<<EOF
[Unit]
Description=My Python service
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/python3 /path/to/myscript.py
User=
Restart=always

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl start myscript.service
sudo systemctl enable myscript.service

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注