4

I'm trying to restart a custom IRC bot. I tried various commands :

load.php  
daemon load.php  
daemon load.php &&  

But that makes the script execute inside the console (I see all the output) and when I quit the bot quits as well.

The bot author only taught me the IRC commands so I'm a bit lost.

WaterBearer
  • 229
  • 1
  • 5
  • 13

3 Answers3

8

You can install a package called screen. Then, run screen -dm php load.php and resume with screen -dR

This will allow you to run the script in the background, and still be able to use your current SSH terminal. You can also logout and the process will still be running.

Clay Freeman
  • 533
  • 5
  • 17
1

Chances are good the shell is sending the HUP signal to all its running children when you log out to indicate that "the line has been hung up" (a plain old telephone system modem reference to a line being "hung up" when disconnected. You know, because you "hang" the handset on the hook...)

The HUP signal will ask all programs to die conveniently.

Try this:

nohup load.php &

The nohup asks for the next program executed to ignore the HUP signal. See signal(7) and the nohup(1) manpages for details. The & asks the shell to execute the program in the background.

Clay's answer of using screen(1) is pretty awesome, definitely look into screen(1) or tmux(1), but I don't think that they are necessary for this problem.

Community
  • 1
  • 1
sarnold
  • 102,305
  • 22
  • 181
  • 238
  • nohug works but the bot quits after I try to PM it. There must be something I'm missing, will have to wait for the author to come back after xmas :-( – WaterBearer Dec 24 '11 at 00:58
  • Perhaps the bot expects to always have a terminal. Try Clay's recommendation of `screen` and see if the bot lives when you PM it. – sarnold Dec 24 '11 at 01:00
0

This line might help you

php load.php &
Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367