Hello,

My solution for Debian:

Add:

>         FILE *pFile = fopen("/tmp/aped.pid", "w");
>         if (pFile != NULL) {
>                 fprintf (pFile, "%d", getpid());
>                 fclose(pFile);
>         }
>         else {
>                 printf("pid error!\n\n");
>         }

After:

>         printf("Starting daemon.... pid : %i\n\n", getpid());


into src/entry.c

and create:

> #! /bin/sh
> ### BEGIN INIT INFO
> # Provides:             aped
> # Short-Description:    aped - Real time data streaming
> # Description:          aped - Real time data streaming
> ### END INIT INFO
>
>
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> DAEMON=/usr/local/bin/aped/bin/aped
> CONF=/usr/local/bin/aped/bin/ape.conf
> OPT="--cfg $CONF"
> NAME=aped
> DESC=aped
> PIDFILE=/tmp/$NAME.pid
>
> test -x $DAEMON || exit 0
>
> set -e
>
> case "$1" in
>   start)
>         echo -n "Starting $DESC: "
>         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec 
> $DAEMON -- $OPT
>         echo "$NAME."
>         ;;
>   stop)
>         echo -n "Stopping $DESC: "
>         start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE 
> --exec $DAEMON
>         echo "$NAME."
>         rm -f $PIDFILE
>         ;;
>
>   restart|force-reload)
>         echo -n "Restarting $DESC: "
>         set +e; $SELF stop; set -e
>         $SELF start
>
>         ;;
>   *)
>         N=/etc/init.d/$NAME
>         echo "Usage: $N {start|stop|restart|force-reload}" >&2
>         exit 1
>         ;;
> esac
>
> exit 0
@Anthony Catel: Serait-il possible d'ajouter l'écriture du pid dans un 
pidfile comme mon patch ci dessus ? Cela permettrait d'utiliser 
proprement le start-stop-daemon à la sauce Debian...
Thanks.


eth0 a écrit :
> May be of use (used on CentOS 5.3), obviously change the /home/
> ifc0nfig/APE/ to whatever suits your needs;
>
> #!/bin/bash
> #
> # aped        This shell script takes care of starting and stopping
> #             standalone aped.
> #
> # chkconfig: - 60 50
> # description: aped is an ajax push engine
> # processname: aped
> # config: /home/ifc0nfig/APE/bin/ape.conf
>
> # Source function library.
> . /etc/rc.d/init.d/functions
>
> # Source networking configuration.
> . /etc/sysconfig/network
>
> # Check that networking is up.
> [ ${NETWORKING} = "no" ] && exit 0
>
> [ -x /home/ifc0nfig/APE/bin/aped ] || exit 0
>
> RETVAL=0
> prog="aped"
>
> start() {
>         # Start daemons.
>
>         echo -n $"Starting $prog: "
>         daemon /home/ifc0nfig/APE/bin/aped --cfg /home/ifc0nfig/APE/
> bin/ape.conf
>         RETVAL=$?
>         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
>         echo done
>
>         return $RETVAL
> }
>
> stop() {
>         # Stop daemons.
>         echo -n $"Shutting down $prog: "
>         killproc $prog
>         RETVAL=$?
>         echo
>         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
>         return $RETVAL
> }
>
> # See how we were called.
> case "$1" in
>   start)
>         start
>         ;;
>   stop)
>         stop
>         ;;
>   restart|reload)
>         stop
>         start
>         RETVAL=$?
>         ;;
>   status)
>         status $prog
>         RETVAL=$?
>         ;;
>   *)
>         echo $"Usage: $0 {start|stop|restart|status}"
>         exit 1
> esac
>
> exit $RETVAL
>
>
>
> On Sep 14, 5:52 pm, cauet <[email protected]> wrote:
>   
>> Hello,
>>
>> Nice work, I discovered EPA since this morning !
>> Perhaps you could add this line in entry.c:
>>
>> 74: printf("Starting daemon.... pid : %i\n\n", getpid());
>> 75: echo getpid() > /var/run/aped.pid
>>
>> It would be easier to find the controller server using init.d
>> script ...
>>
>> Thank you;
>> Mickael.
>>     
> >
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/
-~----------~----~----~----~------~----~------~--~---

Reply via email to