Re: Eu questions in Linux
On Thu, 29 Jun 2000, Kayhlan wrote:
> Greetings All,
> I am writing a server program for a linux environment and am having a
> few troubles I was hoping someone could help with..
> I want to code a program that will check to see if my server program is
> running and if not, start it back up again. I know the theory (or at
> least have
> an idea) yet I am not quite sure what the commands would be to do this.
> My server program runs off of port 23 so I was assuming that all I need
> to do is check the port to see if it is bound and if not, restart the
> server
> program. Anyone out there know if I am thinking in the right
> direction???
>
> Also, I am running into several segmentation error messages that do not
> leave any sort of error record, I cannot reproduce them when I run the
> server
> program with the exu command yet they appear quite frequently when I use
> the
> nohup command...
> (nohup exu dada.ex arg1 > /dev/null &)
> (Thank you Irv and Pete) :)
>
> Any help would of course be helpful... Thanks!
One problem i can see right off the bat is that you are trying to run a linux
daemon ( server ) on port 23. You may not be running the standard telnetd daemon
there but unless you are running your server with root privileges, you will not
be able to use port 23. Here is the why: Linux does not allow any user to
run a daemon on a port lower than 1024 without root privileges. The reason?
When daemons used to be used directly ( telnet, finger, etc ) alot more
frequently then they are used today, a port under 1024 was assumed to be a
trusted daemon, because only the admin could run a daemon on these ports. I
guess the trend just continued.
and you are mostly correct about finding out how if the server is still
running but it might also help to attempt to connect to the port, not
just check if it is bound yet. A shell script might be easier ( at
least for me ):
*untested*
#/bin/sh
# crappy way to test if program is running
if [ ps -aux | grep serv_name ]; then # check if prog is running
serv_name # restart
fi
*untested*
Im pretty sure then if statement will need some sort of "-character" flag, but
im not sure which one.
anyways, i hope that helps a little at least.
--
CenSe,
a member of the
ak-software development team
http://ak-software.virtualave.net/
|
Not Categorized, Please Help
|
|