This is how I start a half-life dedicated server from my rc scripts.
This can be modified to use for just about any application you wish to
run upon startup
near the end ofthe start case
#need to set/export the HLDIR for use with find/su
HLDIR=/home/hlds/hlds_l
export HLDS
#incae we crashed lets removethe old pid file from
#hlds_ld so we can start fresh
find $HLDIR -name "*.pid" -exec rm -f {} \;
echo "Starting Half-Life Dedicated Server"
# su over the hlds and kick off the server sending it to the background
su - hlds -c "$HLDIR/hlds_ld cstrike" &
near the end of the stop case
echo "Shutting down Half-Life dedicated server"
#find the hlds_ld process and kill it
#do not rely on pidof tcl seeing there might be other
#tcl proceses running
kill -9 `ps-ef | grep hlds_ld | grep -v grep | awk '{ print $2 }'`
#kill hlds_run via pidof, I only run one server so there is no
#need to check for other instances etc...
kill -9 `pidof hlds_run`
why do i do it like this?
well if you put the startup stuff in rc.local it will fire when the server
starts which is great, but it fires again during shutdown which is not great
;)
So, I modified /etc/rc.d/init.d/network and added the startup to the start
case ahd the shutdown to the stop case.
i also do not use pidof on hlds_ld seeing that the actual command is ran
through tcl, I did not think it would be wise to kill pidof tcl seeing I
might run other tcl proceeses which would cause problems.
The above has been running on my linux box for roughly 3 months now with no
issues.
regards,
Ron
-----Original Message-----
From: Anton Graham [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 20, 2000 11:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [expert] rc.local Starting Applications Under Specific User
- How To?
Submitted 19-Jun-00 by Civileme:
> I would simply put it into the appropriate user's .bashrc (or
> whatever shell you are talking about)
The problem with this approach rather than su user -c "command" from
/etc/rc.d/rc.local is that you get a new instance with each login
shell. Since I frequently use 3-4 vc's, this would be impractical.
--
_
_|_|_
( ) * Anton Graham
/v\ / <[EMAIL PROTECTED]>
/( )X
(m_m) GPG ID: 18F78541
Penguin Powered!