samizdat-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

boot up init.d script hack for fedora


From: boud
Subject: boot up init.d script hack for fedora
Date: Thu, 1 Feb 2007 00:44:56 +0100 (CET)

yep, me again,

This is a hack which works on fedora core 2, since the debian script
failed because start-stop-daemon was missing (i couldn't find out how
to install it and i suspected that hacking something like this could
go more deeply into the system than would be safe - samizdat is not the
only service on the server).

It's a bit rough. The stop function seems to kill this script as well
as the samizdat-drb-server (problem with "-" in parsing output from ps  ???)
and returns to the terminal prompt without printing an end-of-line.

But it seems to work and i thought a rough hack that works might be
useful to others.


cheers
boud




--- /etc/init.d/samizdat        2006-09-13 14:50:31.000000000 +0200
+++ samizdat_init.d     2007-01-29 02:19:03.000000000 +0100
@@ -1,6 +1,7 @@
 #! /bin/sh

 # Samizdat dRuby object cache server init script
+# 27.01.2007 - hacked for fedora - boud
 # May 2005
 # Dmitry Borodaenko

@@ -20,9 +21,13 @@
 #              database access dispatcher.
 ### END INIT INFO

-PATH=/sbin:/bin:/usr/sbin:/usr/bin
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/ruby/bin
 CHUID=nobody
-DAEMON=/usr/bin/samizdat-drb-server
+DAEMON=/usr/local/bin/samizdat-drb-server
 NAME=samizdat-drb-server
 SNAME=samizdat
 DESC="Samizdat object cache"
@@ -64,33 +69,49 @@
   start)
        log_begin_msg "Starting $DESC:"
        log_progress_msg $NAME
-       start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \
-           $NICE --oknodo --startas $DAEMON -- $OPTIONS
+       #start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \
+       #    $NICE --oknodo --startas $DAEMON -- $OPTIONS
+       echo -n $"Starting $PNAME: "
+       #daemon $NICE $DAEMON -r $SPAMD_PID
+       daemon $DAEMON  # crude but fedora doesn't have the stop-start-daemon
+       echo ""
+       RETVAL=$?
+        echo
        log_end_msg $?
        ;;

   stop)
        log_begin_msg "Stopping $DESC:"
        log_progress_msg "$NAME"
-       start-stop-daemon --stop --pidfile $PIDFILE --oknodo
-       rm -f $PIDFILE
+       #start-stop-daemon --stop --pidfile $PIDFILE --oknodo
+        killproc ${NAME}  # crude but fedora doesn't have the stop-start-daemon
+       #rm -f $PIDFILE
+       if [ $RETVAL = 0 ]; then
+           echo ""
+       fi
        log_end_msg $?
        ;;

+# fedora hack: reload is really just start
   reload|force-reload)
        log_begin_msg "Reloading $DESC:"
        log_progress_msg $NAME
-       start-stop-daemon --stop --pidfile $PIDFILE --signal HUP
+       #start-stop-daemon --stop --pidfile $PIDFILE --signal HUP
+       #killproc $NAME   # crude but fedora doesn't have the stop-start-daemon
+       daemon $DAEMON
        log_end_msg $?
        ;;

+# fedora hack: restart is really just start
   restart)
        log_begin_msg "Restarting $DESC:"
        log_progress_msg $NAME
-       start-stop-daemon --stop --pidfile $PIDFILE --oknodo
-       rm -f $PIDFILE
-       start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \
-           $NICE --oknodo --startas $DAEMON -- $OPTIONS
+       #start-stop-daemon --stop --pidfile $PIDFILE --oknodo
+       #rm -f $PIDFILE
+       #start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \
+       #    $NICE --oknodo --startas $DAEMON -- $OPTIONS
+       #killproc $NAME
+       daemon $DAEMON
        log_end_msg $?
        ;;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]