Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Untitled
Monday, May 28th, 2007 at 7:42:31am UTC 

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          dbus
  4. # Required-Start:    $local_fs $syslog
  5. # Required-Stop:     $local_fs $syslog
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      S 0 1 6
  8. ### END INIT INFO
  9. # -*- coding: utf-8 -*-
  10. # Debian init.d script for D-BUS
  11. # Copyright © 2003 Colin Walters <[email protected]>
  12. # Copyright © 2005 Sjoerd Simons <[email protected]>
  13.  
  14. set -e
  15.  
  16. DAEMON=/usr/bin/dbus-daemon
  17. UUIDGEN=/usr/bin/dbus-uuidgen
  18. UUIDGEN_OPTS=--ensure
  19. NAME=dbus
  20. DAEMONUSER=messagebus
  21. PIDDIR=/var/run/dbus
  22. PIDFILE=$PIDDIR/pid
  23. DESC="system message bus"
  24. EVENTDIR=/etc/dbus-1/event.d
  25.  
  26. test -x $DAEMON || exit 0
  27.  
  28. . /lib/lsb/init-functions
  29.  
  30. # Source defaults file; edit that file to configure this script.
  31. ENABLED=1
  32. PARAMS=""
  33. if [ -e /etc/default/dbus ]; then
  34.   . /etc/default/dbus
  35. fi
  36.  
  37. test "$ENABLED" != "0" || exit 0
  38.  
  39. create_machineid() {
  40.   # Create machine-id file
  41.   if [ -x $UUIDGEN ]; then
  42.     $UUIDGEN $UUIDGEN_OPTS
  43.   fi
  44. }
  45.  
  46. start_it_up()
  47. {
  48.   if [ ! -d $PIDDIR ]; then
  49.     mkdir -p $PIDDIR
  50.     chown $DAEMONUSER $PIDDIR
  51.     chgrp $DAEMONUSER $PIDDIR
  52.   fi
  53.   if [ -e $PIDFILE ]; then
  54.     PIDDIR=/proc/$(cat $PIDFILE)
  55.     if [ -d ${PIDDIR} -a  "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
  56.       log_success_msg "$DESC already started; not starting."
  57.     else
  58.       log_success_msg "Removing stale PID file $PIDFILE."
  59.       rm -f $PIDFILE
  60.     fi
  61.   fi
  62.   create_machineid
  63.  
  64.   log_daemon_msg "Starting $DESC" "$NAME"
  65.   start-stop-daemon --start --quiet --pidfile $PIDFILE \
  66.     --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS
  67.   log_end_msg $?
  68.   if [ -d $EVENTDIR ]; then
  69.       run-parts --arg=start $EVENTDIR || true
  70.   fi
  71. }
  72.  
  73. shut_it_down()
  74. {
  75.   if [ -d $EVENTDIR ]; then
  76.       run-parts --reverse --arg=stop $EVENTDIR || true
  77.   fi
  78.   log_daemon_msg "Stopping $DESC" "$NAME"
  79.   start-stop-daemon --stop --retry 60 --quiet --oknodo --pidfile $PIDFILE \
  80.     --user $DAEMONUSER
  81.   # We no longer include these arguments so that start-stop-daemon
  82.   # can do its job even given that we may have been upgraded.
  83.   # We rely on the pidfile being sanely managed
  84.   # --exec $DAEMON -- --system $PARAMS
  85.   log_end_msg $?
  86.   rm -f $PIDFILE
  87. }
  88.  
  89. reload_it()
  90. {
  91.   create_machineid
  92.   log_action_begin_msg "Reloading $DESC config"
  93.   dbus-send --print-reply --system --type=method_call \
  94.             --dest=org.freedesktop.DBus \
  95.             / org.freedesktop.DBus.ReloadConfig > /dev/null
  96.   # hopefully this is enough time for dbus to reload it's config file.
  97.   log_action_end_msg $?
  98. }
  99.  
  100. case "$1" in
  101.   start)
  102.     start_it_up
  103.   ;;
  104.   stop)
  105.     shut_it_down
  106.   ;;
  107.   reload|force-reload)
  108.     reload_it
  109.   ;;
  110.   restart)
  111.     shut_it_down
  112.     start_it_up
  113.   ;;
  114.   *)
  115.     echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" >&2
  116.     exit 2
  117.   ;;
  118. esac
  119.  
  120. exit 0

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right