server.stop
This commit is contained in:
parent
86b77495df
commit
6a5fe53131
11
serverstop.py
Normal file
11
serverstop.py
Normal 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}")
|
Loading…
Reference in New Issue
Block a user