Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Linux Startup Script  (Read 4502 times)

0 Members and 1 Guest are viewing this topic.

etalley

  • Guest
Linux Startup Script
« on: July 05, 2007, 04:39:40 PM »

Does anyone know where I can find a script I can throw into /etc/rc.d/init.d to automatically load the Anope services on boot? Normally I just edit the file that is run to start a program and add chkconfig parameters at the beginning for RedHat to recognize it, but the file to start up Anope is compiled. I tried using the example.chk, but it didn't start the service automatically when I started up the server.

Thanks,

[Edited on 5-7-2007 by etalley]
Logged

SNU

  • Anope User
  • Offline Offline
  • Posts: 158
    • http://www.firstclassirc.com
(No subject)
« Reply #1 on: July 06, 2007, 06:53:20 PM »

Hmm. I did not test it but it looks like that it works.
Maybe you can report me if it does. I got it from another board. The root of this script is a bouncer-init-script for debian. In debian there it lies in /etc/init.d/<scriptname> yours seems a redhat one...
use that script of your OWN risk! I did NOT test it! youre testing it, if you try it :D

so paste that following code into a file "anope" eg: /etc/rc.d/init.d/anope or /etc/init.d/anope


Code: [Select]
#! /bin/sh

### !!!please edit!!! ###
HOME=/path/to/services
USER=<account which anope services runs on>

## note: in line 19 as you can see, -logchan is enabled.
# remove "-logchan" if you dont want it enabled.


-----------------------------------------------
# do not edit!
DESC="anope IRC services"
NAME=anope
SCRIPTNAME=/etc/init.d/$NAME

do_start()
{
    su $USER -c "cd $HOME; ./services -logchan"
}
do_stop()
{
    su $USER -c "killall services"
}

case "$1" in
  start)
    echo "Starting $DESC $NAME"
        do_start
        ;;
  stop)
        echo "Stopping $DESC $NAME"
        do_stop
        ;;
  restart)
        echo "Stopping $DESC $NAME"
        do_stop
        echo "Starting $DESC $NAME"
        do_start
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart}"
esac


chmod it executable! (eg: "chmod 700 /etc/rc.d/init.d/anope" )
now you might start/stop /restart anope like a daemon and it might be started at startup. try "/etc/rc.d/init.d/anope start"

but remember: I did not test it!! IT should not crash your machine but it might not work or maybe harm your services-installation, so test it on a testing machine is appreciated. (esp the stop and restart -command may not work  as expected)
Logged

katsklaw

  • Guest
(No subject)
« Reply #2 on: July 06, 2007, 08:56:22 PM »

personally I think this would be better since it's possible to run more than 1 copy of services.

Code: [Select]

do_stop()
{
su $USER -c "kill 'cat $HOME\services.pid'"
}


However, I see no reason why crontab is an inferior method as opposed to an init.d startup script.
Logged
Pages: [1]   Go Up