How to run a PHP script via SSH and keep it running after I quit - ssh

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.

This line might help you
php load.php &

Related

JSch for pbrun not working

I tried to execute pbrun using JSch. But it gets into infinite loop. I tried the same program using the JSch site examples to execute the command. I even tried session.setPty(true) before session. connect(). Still, its not working. Please help.
I've found a solution by my own research. We can use pbrun with -c option so that we launch pbrun and get the command output in one shot. In my case, i have passwordless connectivity. So It is like pbrun su - username -c 'command'
From what I read about pbrun, it seems like it starts a new shell (similarly to su).
So if by "inifinite loop" you mean that pbrun never finishes, it is (might be) correct. It never finishes, the same way su never finishes (until you issue an exit command).

Close process in NSIS script during install

I plug nsProcess to close a running program but when I close it, a message will appear stating "Are you sure? OK - Cancel".
How can I automatically, during installation, chose option "Yes", without direct user intervention?
$ {nsProcess :: CloseProcess} "yahoomessanger.exe" $ R0
nsProcess::CloseProcess tries to be nice and posts WM_CLOSE to the application, use nsProcess::KillProcess to kill it without giving the app a chance to close properly...

Can I retrieve the output of a program, that is running in another terminal and/or run by root as e.g a cronjob?

Just for the sake of the question, say I open a terminal an log into my Linux computer. I run a program that keeps outputting information on my screen, looping. I close the terminal window, and the program shuts down.
I set up a cronjob or a startup script that launches the same program as in example 1. The program is looping now, run as root.
I open a terminal, and log into my computer through SSH. Can I make a Bash script that retrieves the output of said program, even if it's running somewhere in the background? I mean, is the program "virtually" outputting information (as in example 1)?
The program closes stdout and stderr when it exits. Looping it as you describe will just cause it to start and exit continuously. You could look at redirecting stdout and stderr.

Can't write in tcl command line unless sending echo, after using PLINK

I'm having a confusing problem running a variety of programs from a tcl script. Here's the story: I have a script (in tcl) which executes plink to establish a remote connection on a Linux computer. I basically use eval for calling plink, sending as parameters some ssh commands and info, and also a bash file to be executed on the Linux computer.
So far, that works fine, or at least it does what I intend it to do. The issue here is that after calling this procedure, my prompt stops working the normal way. I can type, but it doesn't appear on screen unless the command I send is "echo" (without ""). If so, I get the "ECHO is on" message and the prompt continues to work normally.
Does anyone have any idea why this could be happening? I thought about just patch it and add the "echo" command inside my script, but it says that it's an invalid command in this case...
Well, thanks for the help!

beep remote tmux when job is done

im a linux fan.
A few days ago i found tmux very useful.
Now im using it all day.
I run tmux on a remote shell and working there. On my local pc only one terminal working.
And i found interesting thing:
my mutt program is beeping when new mail arrives. And tmux is transferring this beep to my local PC, is there a way to run similar beep by any shell command ?
I want to use it for some command finishing sign.
I wrote a little script called beep.sh that I use for things like that:
#!/bin/bash
echo $'\a' > `/usr/bin/tty`