Author |
Message |
solute
Kai Beginner
Joined: 16 Dec 2004
Posts: 15
Location: Germany
|
Posted:
Fri Aug 05, 2005 9:34 am |
|
hi,
this is my quickNdirty init script for kaid on debian.
on start it creates a pid file in /var/run and kills the according process on stop. you'd probably have to change the kaid, conf and log path.
when saved to /etc/init.d/kaid, you can create the rc symlinks with "update-rc.d kaid defaults" for automated startup on boot. if you need kaid to be started earlier or later or want to remove the links have a look at "man update-rc.d". it's really simple.
Code: |
#! /bin/sh
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Console network gaming tunneling service"
NAME=kaid
DAEMON=/usr/local/kaid/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
#
# Function that starts the daemon/service.
#
d_start() {
start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE \
--exec $DAEMON -- -c /usr/local/kaid/kaid.conf > /var/log/kaid.log &
}
#
# Function that stops the daemon/service.
#
d_stop() {
kill -9 `cat $PIDFILE`
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0 |
|
|
|
|
|
Hogmeister
Kai Beginner
Joined: 03 Aug 2005
Posts: 2
Location: USA - Pennsylvania
|
Posted:
Sun Aug 07, 2005 2:39 pm |
|
i used the redhat/fedora script that was i think the first reply in this thread and it's working great for me in FC4
loving it, but now that i see some debian folks have it to automatically start on boot as a service is it possible to do so on fedora core 4 as well? i was thinking of using the scripts posted and doing the update-rc.d but unfortunately update-rc.d only returns an unknown command when i try it
helpppp i LOVE kai lol |
|
|
|
|
cyborgas
Team XLink Moderator
Joined: 14 Jul 2004
Posts: 209
Location: Portugal
|
Posted:
Sun Aug 07, 2005 7:30 pm |
|
Hogmeister,
after you create the kaid init.d script explained on top of this thread.
To be able to set kaid to run at startup, do this:
to switch to user root do
to open the services UI manager do
Code: |
system-config-services |
Then in the toolbar menu in Actions -> Add Service
and add the name kaid
Then, to finish this configuration, check if kaid service is enabled to start on boot.
There's other ways to do this, but this is the easyest one. |
_________________ Cyborgas - Caution, beware of the tux! |
|
|
|
Hogmeister
Kai Beginner
Joined: 03 Aug 2005
Posts: 2
Location: USA - Pennsylvania
|
Posted:
Sun Aug 07, 2005 7:48 pm |
|
wow much thanks! works like a charm thank you thank you... |
|
|
|
|
Dren
Kai Beginner
Joined: 19 Feb 2005
Posts: 7
|
Posted:
Mon Jan 09, 2006 3:24 am |
|
Here's a script I made (modified from existing script actually) that uses screen to run Kaid in the background when you boot your Linux server.
Code: |
#!/bin/sh
#
# Kaid server startup script
#
# What you need:
#
# Linux
# awk
# screen
# kaid server from http://www.teamxlink.co.uk/
#
# How to use:
#
# Edit DIR, DAEMON, NAME, and DESC variables below to fit your system needs.
#
# When this is done, copy the file to /etc/init.d (or where ever your
# system stores the scripts for starting the services)
# Now you can link the script to your runlevel directory, here's an example for
# runlevel 3:
#
# ln -s /etc/init.d/kaid /etc/rc3.d/S90kaid
# ln -s /etc/init.d/kaid /etc/rc3.d/K50kaid
#
# Or use it manualy:
#
# /etc/init.d/kaid start
# /etc/init.d/kaid stop
#
# How to see the server-console:
#
# Just type in: screen -r kaid
# More info about screen can be found by typing "man screen"
#
###############################################################################
#
# EDIT VARIABLES BELOW
#
# Path to Kaid program
DIR=/path/to/kaid
#
# Kaid program name (default should be fine)
DAEMON=$DIR/kaid
#
# Name to use for creating and reconnecting screen (default should be fine)
NAME=kaid
#
# Nice output (default should be fine)
DESC="Kaid server"
###############################################################################
#
# DO NOT EDIT BEYOND HERE (unless you know what you're doing)
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
case "$1" in
start)
if [ -e $DIR ]; then
echo "Starting $DESC: $NAME"
cd $DIR
screen -d -m -S $NAME $DAEMON
else
echo "No such directory: $DIR!"
fi
;;
stop)
if [[ `screen -ls |grep $NAME` ]]; then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
;;
restart)
if [[ `screen -ls |grep $NAME` ]]; then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
echo -n "Starting $DESC: $NAME"
cd $DIR
screen -d -m -S $NAME $DAEMON
echo " ... done."
;;
status)
ps aux | grep -v grep | grep $NAME > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "$NAME is UP" || echo "$NAME is DOWN"
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0 |
So now when I boot up my server it automatically starts the kaid server. I just use XBMC for my front end and everyone's happy. |
Last edited by Dren on Fri Oct 31, 2008 5:01 am; edited 1 time in total |
|
|
|
nexus_6
Kai Beginner
Joined: 23 Apr 2005
Posts: 6
Location: Austria
|
Posted:
Tue Feb 28, 2006 8:19 pm |
|
|
|
|
|
|
View next topic
View previous topic
You can post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB
© 2001, 2002 phpBB Group :: Theme by Daz ::
All times are GMT
| |