【发布时间】:2015-11-23 18:32:06
【问题描述】:
我正在尝试从 django 应用程序检测错误并重新启动服务器。 我正在使用以下代码:
try:
# do something
except:
print('here')
subprocess.call(['/home/my_username/restart.sh'])
restart.sh如下
#!/bin/sh
/home/my_username/webapps/app/apache2/bin/restart
/home/my_username/webapps/my_db/bin/cron
我正在使用 webfaction 作为托管服务提供商。 以上代码打印语句,但不重启服务器,也不启动my_db下的mysql数据库。
也许我需要提供用户名/密码?该怎么做?
【问题讨论】:
标签: django python-2.7