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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With