LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Running programs via SSH (https://www.linuxquestions.org/questions/linux-general-1/running-programs-via-ssh-2637/)

DJFauß 05-20-2001 02:18 AM

I have a Network with a Linux router / server which is supposed to be running UT as a server.

I don't wanna have UT running the whole time for pings sake when I play on a server on the other side of the network (map changing on my own server will kill me ...)

I access my server via SSH2. When I start UT from the SSH console I have the problem that I can't close the console without killing the UT process on the way (as a result I can't crash my own computer or turn it off).

QUESTION: Is there a way to execute a shell command from within the SSH console that runs UT as a service or virtually on another console (like tty2 ?).

unSpawn 05-20-2001 04:51 PM

u can run it in the background if it doesnt need commandline control. make this script executable (chmod 0500).
#cut after this line
#!/bin/sh
case "$1" in
start)
echo -n "Starting UT Server"
#A &
;;
kill)
echo -n "Stopping UT Server"
kill -s TERM $(pidof #B)
;;
*)
echo "Usage: #C {start|kill}"
exit 1
esac
exit 0
#cut before this line

substitute for #A /path/to/name_of_executable
substitute for #B name_of_executable
substitute for #C scriptname
now u can run it as "scriptname start"
*Always be carefull with scripts u didnt write ureself...

unSpawn 05-20-2001 04:58 PM

Indentation clearly sux0rz here :-] Indentation aint necessary, but when u get to edit larger scripts ure glad uve trained ureself to code clearly. Replace the underscores with spaces or pipe tru sed like this: cat script.badder | sed -e "s/_/ /g" > script.better

#cut after this line
#!/bin/sh
case "$1" in
_____start)
___________echo -n "Starting UT Server"
___________#A &
___________;;
______kill)
___________echo -n "Stopping UT Server"
___________kill -s TERM $(pidof #B)
___________;;
_________*)
___________echo "Usage: #C {start|kill}"
___________exit 1
esac
exit 0
#cut before this line

DJFauß 05-21-2001 12:36 PM

Thx for the script (I really need this bad) ... but would this actually run the program on another console? If I close the SSH2 console UT will be deleted out of memory, won't it?

unSpawn 05-21-2001 04:39 PM

just make the line where we start the server like this:

nohup server_executable &

if u logout itll still run, have a nice value & when u log on u can catch any errors from file nohup.out

DJFauß 05-22-2001 11:33 AM

Thx .. this solved my problem ...


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