mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-09 11:58:02 +02:00
* dbus/dbus-sysdeps.c (_dbus_become_daemon): write the pidfile here in the parent process, so we can return an error if it fails. Also, move some of the code into the child so the parent is less hosed if we fail midway through. * bus/bus.c (bus_context_new): move pidfile detection further up in the function, before we start overwriting sockets and such. * bus/messagebus.in: adjust this a bit, not sure if it will work. * configure.in: add --with-system-pid-file and --with-system-socket 2003-04-06 Colin Walters <walters@verbum.org> * configure.in (DBUS_SYSTEM_PID_FILE): New variable. * bus/system.conf.in: Declare a pidfile. * bus/bus.c (bus_context_new): Test for an existing pid file, and create one (if appropriate). * bus/config-parser.c (enum ElementType) [ELEMENT_PIDFILE]: New. (struct BusConfigParser) [pidfile]: New. (element_type_to_name, merge_included, start_busconfig_child) (bus_config_parser_end_element, bus_config_parser_content): Handle it. (bus_config_parser_unref): Free it. (bus_config_parser_get_pidfile): New function. * bus/config-parser.h (_dbus_write_pid_file): Prototype. * dbus/dbus-errors.h (DBUS_ERROR_PIDFILE_EXISTS): New error. * dbus/dbus-sysdeps.c (_dbus_write_pid_file): New function. * dbus/dbus-sysdeps.h: Prototype it.
73 lines
1.7 KiB
Bash
Executable file
73 lines
1.7 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# messagebus: The D-BUS systemwide message bus
|
|
#
|
|
# chkconfig: 345 97 03
|
|
# description: This is a daemon which broadcasts notifications of system events \
|
|
# and other messages. See http://www.freedesktop.org/software/dbus/
|
|
#
|
|
# processname: dbus-daemon-1
|
|
# pidfile: @DBUS_SYSTEM_PID_FILE@
|
|
#
|
|
|
|
# Sanity checks.
|
|
[ -x @EXPANDED_BINDIR@/dbus-daemon-1 ] || exit 0
|
|
|
|
# Source function library.
|
|
. @EXPANDED_SYSCONFDIR@/rc.d/init.d/functions
|
|
|
|
RETVAL=0
|
|
|
|
start() {
|
|
echo -n $"Starting system message bus: "
|
|
daemon --check messagebus dbus-daemon-1 --system
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus
|
|
}
|
|
|
|
stop() {
|
|
echo -n $"Stopping system message bus: "
|
|
|
|
## we don't want to kill all the per-user dbus-daemon-1, we want
|
|
## to use the pid file *only*; because we use the fake nonexistent
|
|
## program name "messagebus" that should be safe-ish
|
|
killproc messagebus -TERM
|
|
RETVAL=$?
|
|
echo
|
|
if [ $RETVAL -eq 0 ]; then
|
|
rm -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus
|
|
fi
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status messagebus
|
|
RETVAL=$?
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
condrestart)
|
|
if [ -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus ]; then
|
|
stop
|
|
start
|
|
fi
|
|
;;
|
|
reload)
|
|
echo "Message bus can't reload its configuration, you have to restart it"
|
|
RETVAL=$?
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
|
|
;;
|
|
esac
|
|
exit $RETVAL
|