server.stop

This commit is contained in:
lqs 2024-08-24 10:46:05 +08:00
parent 86b77495df
commit 6a5fe53131

11
serverstop.py Normal file
View File

@ -0,0 +1,11 @@
import subprocess
# 使用subprocess执行命令
result = subprocess.run(['sudo', 'systemctl', 'stop', 'django_app'], capture_output=True, text=True)
# 打印输出(如果有的话)
print(result.stdout)
# 检查是否有错误
if result.stderr:
print(f"Error: {result.stderr}")