FAQ  •  Search  •  Profile  •  Log in to check your private messages  •  Log in
 Contributions - Init scripts, launchers, ... View next topic
View previous topic
Post new topicReply to topic
Author Message
Johndoe
Kai Beginner
Kai Beginner


Joined: 21 May 2004
Posts: 15
Location: Netherlands

PostPosted: Thu Oct 21, 2004 2:54 pm Reply with quoteBack to top

Hi everybody,

I'm using gentoo on my 24/7 linux server and made this init script so I can run kaid the way the gentoo god intended:

This is for pre-7.0.0.3 kaid versions:
Code:

#!/sbin/runscript
# Kaid script, 21 october 2004, A. Loermans

depend() {
   need net
}

start() {
   ebegin "Starting kaid"
   /opt/kaid/kaid /etc/kaid.conf > /var/log/kaid.log &
   eend $?
}

stop() {
   ebegin "Stopping kaid"
   killall -9 kaid
   eend $?
}


For 7.0.0.3 and later parameters have changed, so use this if you have kaid >= 7.0.0.3

Code:

#!/sbin/runscript
# Kaid script, 10 december 2004, A. Loermans

depend() {
   need net
}

start() {
   ebegin "Starting kaid"
      /opt/kaid/kaid -c /etc/kaid.conf -d
# logging doesn't seem to be working, so we just fork it without logging
   eend $?
}

stop() {
   ebegin "Stopping kaid"
   killall -9 kaid
   eend $?
}


Just copy and paste the above code into a file named 'kaid' and drop that in your /etc/init.d directory. Make sure it is executeable

Code:

# chmod +x /etc/init.d/kaid


and Bob's your uncle

A couple of notes:

    * I copied kaid.conf to /etc where it belongs imho, change to suit your needs
    * all output is logged to /var/log/kaid.log, change to suit your needs
    * the script is very basic and ugly, but works. If someone has a better one, or has suggestions, drop me a note


Have fun and see you online, my x-link tag is caustics

JohnDoe aka Caustics aka Arjan Loermans

[edit] added kaid 7.0.0.3 support, without logging, this seems broken


Last edited by Johndoe on Fri Dec 10, 2004 7:43 pm; edited 2 times in total
View user's profileSend private message
^S^
Team XLink Administrator
Team XLink Administrator


Joined: 09 Sep 2004
Posts: 251
Location: Portugal

PostPosted: Thu Oct 21, 2004 5:43 pm Reply with quoteBack to top

Nice work. Glad to see that people is getting involved.
View user's profileSend private messageMSN MessengerICQ Number
cyborgas
Team XLink Moderator
Team XLink Moderator


Joined: 14 Jul 2004
Posts: 209
Location: Portugal

PostPosted: Thu Oct 21, 2004 7:23 pm Reply with quoteBack to top

Here is my init script for Fedora or RedHat distros

Code:
#!/bin/bash
#
#       /etc/rc.d/init.d/kaid
#
# Starts the kai daemon
#
# chkconfig: 345 95 5
# description: Xlink Kai engine
# processname: kaid
# Author: Cyborgas
# Date released: 20 October 2004

# Source function library.
. /etc/init.d/functions

test -x /usr/bin/kaid || exit 0

RETVAL=0

#
#       See how we were called.
#

prog="kaid"

start() {
        ## After soft-close is implemented on kaid this will be better
        # Check if kaid is already running
        #if [ ! -f /var/lock/subsys/kaid ]; then
            echo -n $"Starting $prog... done "
            /usr/bin/kaid -c /etc/kaid.conf > /var/log/kaid.log &
        #    RETVAL=$?
        #    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/kaid
            echo
        #else
        #    echo -n $"$prog is already running"
        #    echo
        #fi
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog... done "
        killall -9 kaid
        # After soft-close is implemented on kaid this will be better
        #RETVAL=$?
        #[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/kaid
        echo
        return $RETVAL
}


restart() {
        stop
        start
}

reload() {
        restart
}

status_kaid() {
        status /usr/bin/kaid
}

case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload|restart)
        restart
        ;;
condrestart)
        if [ -f /var/lock/subsys/kaid ]; then
            restart
        fi
        ;;
status)
        status_kaid
        ;;
*)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        exit 1
esac

exit $?
exit $RETVAL


Put this script on /etc/init.d/ with the name kaid
and
Code:
# chmod +x /etc/init.d/kaid


Copy kaid engine to /usr/bin/
and kaid.conf to /etc/
the debug log is available on /var/log/kaid.log

EDITED (05-06-2005): CORRECTED THE '-c' FLAG WHEN STARTING KAID

_________________
Cyborgas - Caution, beware of the tux!

Last edited by cyborgas on Sun Jun 05, 2005 12:07 pm; edited 1 time in total
View user's profileSend private message
Johndoe
Kai Beginner
Kai Beginner


Joined: 21 May 2004
Posts: 15
Location: Netherlands

PostPosted: Fri Oct 22, 2004 7:57 am Reply with quoteBack to top

Can't we make this the official init script thread? Just post all scripts regarding startup and shutdown for the different distro's in this thread and perhaps it can be made sticky.

Edit:

I just saw this thread, sorry to doublepost. Can these threads be joined?

Arjan
View user's profileSend private message
trejkaz
Kai Beginner
Kai Beginner


Joined: 26 Oct 2004
Posts: 3
Location: Australia - NSW

PostPosted: Tue Oct 26, 2004 2:44 am Reply with quoteBack to top

Johndoe wrote:
Hi everybody,

I'm using gentoo on my 24/7 linux server and made this init script so I can run kaid the way the gentoo god intended:


Yes, but... you didn't install it the way the Gentoo god intended. Very Happy

Steps:

1. Ensure you have PORTDIR_OVERLAY="/usr/local/portage" in /etc/make.conf.

2. mkdir -p /usr/local/portage/games-server/kaid/files; cd /usr/local/portage/games-server/kaid

3. create kaid-7.0.0.1.ebuild with the contents of this code block:
Code:
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$

DESCRIPTION="XLink KAI -- link game consoles together over the internet (Xbox only so far)"
HOMEPAGE="http://www.teamxlink.co.uk/"
SRC_URI="http://www.teamxlink.co.uk/binary/unix/${P}-linux.tar.bz2"

LICENSE="as-is"
SLOT="0"
KEYWORDS="-* x86"
IUSE=""

DEPEND=""
RDEPEND="virtual/libc"

S=${WORKDIR}/${PN}

src_compile() {
    echo "Nothing to compile, this is a binary."
}

src_install() {
    exeinto /usr/games/bin
    doexe kaid

    dodoc README

    insinto /etc
    doins kaid.conf

    exeinto /etc/init.d
    doexe ${FILESDIR}/kaid
}


4. create files/kaid with the contents of this code block:
Code:
#!/sbin/runscript
# Kaid script, 21 october 2004, A. Loermans

depend() {
    need net
}

start() {
    ebegin "Starting kaid"
    /usr/games/bin/kaid /etc/kaid.conf > /var/log/kaid.log &
    eend $?
}

stop() {
    ebegin "Stopping kaid"
    killall -9 kaid
    eend $?
}


(This is an only slightly modified version of Johndoe's script, to reflect that I put kaid in /usr/games/bin/kaid. So I left his name on it.)

5. ebuild /usr/local/portage/games-server/kaid/kaid-7.0.0.1.ebuild digest

6. emerge -av kaid

If all goes well you should be prompted to install at this point, and if you confirm that, it should install.

Known issues:

  • The license is currently "as-is". The exact license of XLink would need to be clarified by the XLink team in order to make it into Portage. XLink has no LICENSE file inside its tarball, so it's not really easy to say what I should put it down as. Chances are it will require a custom license to be created.
  • I'm not inheriting from games.eclass, which I probably should, since I'm installing into /usr/games.
  • Running as root is begging to be hacked. I should be using a chroot wrapper of some sort for this.
  • Probably a couple of other minor narks I have with my ebuild, which will be found really quickly by a Portage pro.


If I get these resolved relatively quickly I should probably submit it to the Bugzilla so that it can appear as a real ebuild.
View user's profileSend private message
^S^
Team XLink Administrator
Team XLink Administrator


Joined: 09 Sep 2004
Posts: 251
Location: Portugal

PostPosted: Tue Oct 26, 2004 9:24 am Reply with quoteBack to top

Hi,

Good job all of you. Thanks for those contributions. There is a "Contributions" topic in this forum, next contributions, please, put them there.

About the license, well, we don't have anything defined yet. We'll be releasing the source as soon as we have it complete and by then we'll discuss licensing issues.

Root privileges will be dropped when we have a more advanced status, its just an alpha, people using it should be aware of what they're doing. For now they're required for packet sniffing and packet injection, guess that after having those valid handles I can immediatly drop privs, will check that soon!

I dind't see where did the log go, same place as previous script ? /var/log/kaid.log ?

Cheers.


Last edited by ^S^ on Tue Oct 26, 2004 8:42 pm; edited 1 time in total
View user's profileSend private messageMSN MessengerICQ Number
trejkaz
Kai Beginner
Kai Beginner


Joined: 26 Oct 2004
Posts: 3
Location: Australia - NSW

PostPosted: Tue Oct 26, 2004 9:34 am Reply with quoteBack to top

Yup, /var/log/kaid.log just like the last one (I hardly changed the script at all.)
View user's profileSend private message
Johndoe
Kai Beginner
Kai Beginner


Joined: 21 May 2004
Posts: 15
Location: Netherlands

PostPosted: Tue Oct 26, 2004 11:38 am Reply with quoteBack to top

@trejkaz: Thanks, now this is doing things the gentoo way Cool
View user's profileSend private message
spoone
Kai Beginner
Kai Beginner


Joined: 30 Jul 2004
Posts: 3
Location: Germany

PostPosted: Tue Dec 07, 2004 11:02 am Reply with quoteBack to top

yeah, i installed kai exactly the way you described, trejkas. but for me it does NOT work. i can't connect with my xbox. but when i start my pc running gentoo it says "starting kaid.......................ok". just as my ftp-server and everything, which works fine! but not kaid. what am i doing wrong?
i checked the kaid.conf and everything looks as it should. in the log-file it says "5 orbital meshs available", so there must be a connection. and the files are in the right folders. otherwise kaid wouldn't start at all, would it?
i tried to configure kaid through the winUI, but i didn't get that to work and at least i don't know if this is right to do so.
any suggestions?
please help me as I finally got my gentoo-ftp-server up and running, it would be perfect to run kaid as backgroung-daemon!!!
thanks in advance,
spoone
View user's profileSend private message
trejkaz
Kai Beginner
Kai Beginner


Joined: 26 Oct 2004
Posts: 3
Location: Australia - NSW

PostPosted: Tue Dec 07, 2004 11:52 am Reply with quoteBack to top

Hmm. Not sure, I guess the KAI guys would know more, since it seemed to install fine that's the end of my line. Smile
View user's profileSend private message
spoone
Kai Beginner
Kai Beginner


Joined: 30 Jul 2004
Posts: 3
Location: Germany

PostPosted: Tue Dec 07, 2004 1:37 pm Reply with quoteBack to top

well, here's my log-file:

Reading settings from /etc/kaid.conf
Fetching settings from http://www.teamxlink.co.uk/connector/clientgetconfig.php...
5 orbital(s) available...
Kai daemon starting...
PKTSNIFF: Setting up packet sniffer...
PKTSNIFF: Applying pcap filter 'ether src MY-MAC-ADRESS'
Everything set with packet sniffer...


i think it looks ok. but i can't connect.
i port-forwarded ports 37500, 34522 and 34525 to my gentoo-linux-pc, but after i did ports 34522 and 34525, my xbox doesn't even recognize my home-network. internet works. going to change that again.


location of my files:

kaid.conf Arrow /etc
kaid(.exe) Arrow /usr/games/bin
kaid(runscript) Arrow /etc/init.d


please, if someone knows what to do to get kaid up and running, help me.
PLEASE!!! i'm dying to get this to work...
greetings, spoone

EDIT:
i changed the settings of my router to only port-forward :37500. now my network is reachable again.
View user's profileSend private message
dslam
Kai Beginner
Kai Beginner


Joined: 02 Aug 2004
Posts: 3
Location: Canada

PostPosted: Thu Dec 09, 2004 8:50 pm Reply with quoteBack to top

i have got both kaid .2 and .3 working on debian sarge.
i used the fedora script with the first unhashed line removed, don't know if that's right but wouldn't work for me otherwise
put the bin/conf where they go for fedora, and then update-rc.d with the appropriate string and you should have kai starting with init.d

props to ^S^ for an incredible effort. i'm using xbmc as a ui btw.
View user's profileSend private message
spoone
Kai Beginner
Kai Beginner


Joined: 30 Jul 2004
Posts: 3
Location: Germany

PostPosted: Tue Dec 14, 2004 7:11 am Reply with quoteBack to top

well, thanks for the help!
but 7.0.0.3 is out and i got my new linksys wrt54g, so this is solved anyway as there is no need to use 7.0.0.2 anymore.
7.0.0.3 works great!!!
and the kaistation is the most incredible piece of software. everyone should get a wrt54g. saves power too...
although i don't have that much money, i think that's worth a donation...

Merry Christmas to you, TeamXlink.
have a nice holiday!!!
sincerely yours,
spoone
View user's profileSend private message
darthdavid
Kai Beginner
Kai Beginner


Joined: 24 Dec 2004
Posts: 9
Location: USA - New York

PostPosted: Sun Dec 26, 2004 11:11 pm Reply with quoteBack to top

I'd like to create a script to launch gkaiui and kaid at the same time. However in order to peform one command the next one has to finish first and in order to launch gkaiui kaid needs to stay going, so how would I do that?
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Johndoe
Kai Beginner
Kai Beginner


Joined: 21 May 2004
Posts: 15
Location: Netherlands

PostPosted: Tue Jan 04, 2005 1:19 pm Reply with quoteBack to top

Do something like this (I think this is what you mean):
Code:

#!/sbin/runscript
/path_to_your_kaid_script/kaid &
/path_to_kaigui/gkaiui


That's about it. The '&' takes care of starting kaid in it's own process and giving control back to the shell which proceeds and launches gkaiui.

You have to make the above executable (chmod +x scriptfilename)

JohnDoe
View user's profileSend private message
jorns
Kai Beginner
Kai Beginner


Joined: 21 May 2004
Posts: 8
Location: Norway

PostPosted: Mon Jan 10, 2005 8:22 am Reply with quoteBack to top

dslam @ Thu Dec 09, 2004 9:50 pm wrote:
i have got both kaid .2 and .3 working on debian sarge.
i used the fedora script with the first unhashed line removed, don't know if that's right but wouldn't work for me otherwise
put the bin/conf where they go for fedora, and then update-rc.d with the appropriate string and you should have kai starting with init.d

props to ^S^ for an incredible effort. i'm using xbmc as a ui btw.


Can you show me exactely how you do it? Because when i use the FC script, my computer hangs during bootup. It hangs starting eth0 in promisceus mode.
What do you exatctely type whne you run the 'update-rc.d' ?
View user's profileSend private message
slacker
Kai Beginner
Kai Beginner


Joined: 02 Jun 2004
Posts: 15
Location: USA - New Mexico

PostPosted: Sat Jan 15, 2005 11:24 pm Reply with quoteBack to top

For those who aren't using syslog (or don't know how), for metalog just add this to /etc/metalog/metalog.conf (this is on a Gentoo system):

Code:
kaid :
  program = "kaid"
  logdir = "/var/log/kaid"


Now you're logging the proper way. My init script is the same as the original poster, with the .conf in /etc where it should be. kaid is in /opt/kaid/.
View user's profileSend private message
MOSQUE
Kai Beginner
Kai Beginner


Joined: 21 May 2004
Posts: 3
Location: USA - New Hampshire

PostPosted: Fri Apr 15, 2005 9:50 pm Reply with quoteBack to top

In the Fedora Core instructions it says...

/usr/bin/kaid /etc/kaid.conf > /var/log/kaid.log &

For Fedora Core 3 I had to use...

/usr/bin/kaid -c /etc/kaid.conf > /var/log/kaid.log &

Just add -c
After that it works the nuts THANKS!
View user's profileSend private message
MyHandIsACobra
Kai Beginner
Kai Beginner


Joined: 14 Feb 2005
Posts: 2
Location: Australia - VIC

PostPosted: Sun Jun 05, 2005 11:22 am Reply with quoteBack to top

For Ubuntu users (probably debian also)
follow cyborgas's instructions above (posted Oct 21, 2004 7:23pm)
with MOSQUE's -c modification to file /etc/init.d/kaid (posted Apr 15, 2005 9:50)
and add a symbolic link with the following command

Code:
sudo ln -s /etc/init.d/kaid /etc/rc2.d/S25kaid


(this assumes you will boot to run level 2)
View user's profileSend private message
smo
Kai Beginner
Kai Beginner


Joined: 21 May 2004
Posts: 1
Location: France

PostPosted: Sat Jul 02, 2005 10:36 pm Reply with quoteBack to top

Hi all

I just created this small and basic script (my first) to use kaid as a service and launch at pc boot on debian.

(version 7.0.0.5 for me)

Howto:

1-edit your kaid.conf and copy it to /etc
2-copy the kaid binarie to /usr/bin

3-now copy the script then paste it in /etc/init.d/kaid (create this file)
-save and exit then chmod it with : chmod +x /etc/init.d/kaid (as root sure)

to get it working when pc start type (as root): update-rc.d kaid defaults 19

that's all Wink

Code:

#!/bin/bash
###############################################################
# KAID Daemon script
################################################################
# kaid.conf must be placed in /etc and kaid binary in /usr/bin
#################################################################
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/kaid
NAME=kaid
DESC="free console network gaming system"
KAID_LOG="/var/log/kaid.log"
 
test -x $DAEMON || exit 0
 
set -e
   
# Source configuration parameters
#/etc/kaid.conf
   
OPTIONS="-d -s -o log $KAID_LOG -c /etc/kaid.conf"
     
##start##
     
case "$1" in
start)
echo -n "Starting : $NAME"
start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS
echo "...done"
;;
       
##stop##
       
stop)
echo -n "Stopping : $NAME "
killall -9 `which $NAME`
echo "...done"
;;
   
##restart##
    
restart|force-reload)
echo -n "restarting : $NAME "
$0 stop && $0 start
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart}" >&2
echo "Usage: $N {start|stop|restart}" >&2
exit 1
 ;;
esac



- now you can start it with /etc/init.d/kaid start
- make your own launcher for jkaiui or gkaiui on your desktop with a nice icon and it s perfect Wink

ok sorry for my poor english and enjoy Wink thanks to all the xlink team for their good works Wink. i m there since boxlink and it s always better Wink
Code:
View user's profileSend private messageMSN Messenger
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



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