简体   繁体   中英

PHP Exec bash script to restart screen session

So, I wanted to create a sort of a webadmin panel to restart an IRC bot running in Python.
I have a Bash script that succesfully restarts the bot through the terminal but, when using it with exec on a PHP page it only stops it but doesn't start it again.

Here's the bash script:

screen -S bot -p 0 -X quit
screen -S bot -fa -d -m -L python botpy/Run.py

and here's the php code:

<?php
   ini_set('display_errors', 1);
   error_reporting(E_ALL ^ E_NOTICE);
   exec('sudo /root/bot.sh');
?>

I've created all the exceptions in the sudoers file, which seems to have had effect since it stops the bot itself through the php script.

好的,单击我的头后,我试图在bash脚本和voilá上更改Python脚本的路径,只是添加了/ root /,它现在可以工作了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM