LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ./Kaillera script (https://www.linuxquestions.org/questions/linux-newbie-8/kaillera-script-943507/)

Auzern 05-06-2012 08:00 AM

./Kaillera script
 
Greetings.

I have a newbie question.
I am running a server by executing a command "./kaillera" in Terminal.
The problem is, if I close my terminal, it closes the server program "Kaillera".

How do I execute it as a process so that it runs in the background itself AND every time automatically when the system is switched on?

Again, the file is just called "./kaillera" and there is no make or install valid for it.

BTW, I'm running Centos 5. So any help would be greatly appreciated. :)

Babertje 05-06-2012 10:02 AM

Code:

./kaillera &
Note the & after the command

Auzern 05-06-2012 10:19 AM

Yes, I tried that and it did not work :(

After I close my SSH, even Kaillera closes.

Babertje 05-06-2012 11:03 AM

Ok, create a shellscript like this
Code:

#!/bin/bash
/this/real/path/to/kaillera &

replace the real path, this way make a new shell and you can exit your shh connection

Auzern 05-06-2012 11:16 AM

Thanks a lot. :)
That fixed the problem. But I had to write this:-
Code:

#!/bin/bash
/root/kailleraserv-0.86/
./kaillera &

I saved it as kaillera.sh and executed it with the sh command.

Now is there anyway activate this automatically when it boots up?

Babertje 05-06-2012 11:46 AM

add

Code:

/root/kailleraserv-0.86/kaillera &
to your /etc/rc.local then it starts as the very last thing after all your normal init scripts

easiest way to add that is by typing
Code:

echo "/root/kailleraserv-0.86/kaillera &" >> /etc/rc.local

Auzern 05-06-2012 11:49 AM

I doubt that would work since I tried it earlier.
Remember, I had to type "./kaillera &" to run the server?
So is it possible to add "sh /root/kailleraserv-0.86/kaillera.sh" ?

Babertje 05-06-2012 06:21 PM

yes just call your shell script that contains the "./kaillera $" command and if it's chmodded to execute no need to put sh in front.


All times are GMT -5. The time now is 11:10 PM.