~openstack-ubuntu-packagers/ubuntu/maverick/nova/ubuntu

« back to all changes in this revision

Viewing changes to debian/nova-volume.init

  • Committer: Soren Hansen
  • Date: 2010-11-18 15:16:24 UTC
  • Revision ID: soren.hansen@rackspace.com-20101118151624-ki3kj3dkmuntabkp
Merge packaging from Maverick release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
### BEGIN INIT INFO
 
3
# Provides:          nova-volume
 
4
# Required-Start:    $remote_fs $syslog
 
5
# Required-Stop:     $remote_fs $syslog
 
6
# Default-Start:     2 3 4 5
 
7
# Default-Stop:      0 1 6
 
8
# Short-Description: nova-volume
 
9
# Description:       nova-volume
 
10
### END INIT INFO
 
11
 
 
12
 
 
13
set -e
 
14
 
 
15
DAEMON=/usr/bin/nova-volume
 
16
DAEMON_ARGS="--flagfile=/etc/nova/nova-volume.conf"
 
17
PIDFILE=/var/run/nova/nova-volume.pid
 
18
 
 
19
ENABLED=true
 
20
 
 
21
if test -f /etc/default/nova-volume; then
 
22
  . /etc/default/nova-volume
 
23
fi
 
24
 
 
25
mkdir -p /var/run/nova
 
26
chown nova:nogroup /var/run/nova
 
27
 
 
28
uid="$(getent passwd nova | cut -f3 -d:)"
 
29
gid="$(getent passwd nova | cut -f4 -d:)"
 
30
DAEMON_ARGS="${DAEMON_ARGS} --uid $uid --gid $gid --pidfile $PIDFILE"
 
31
 
 
32
. /lib/lsb/init-functions
 
33
 
 
34
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
 
35
 
 
36
case "$1" in
 
37
  start)
 
38
    test "$ENABLED" = "true" || exit 0
 
39
    log_daemon_msg "Starting nova volume" "nova-volume"
 
40
    cd /var/run
 
41
    if $DAEMON $DAEMON_ARGS start; then
 
42
      log_end_msg 0
 
43
    else
 
44
      log_end_msg 1
 
45
    fi
 
46
    ;;
 
47
  stop)
 
48
    test "$ENABLED" = "true" || exit 0
 
49
    log_daemon_msg "Stopping nova volume" "nova-volume"
 
50
    cd /var/run
 
51
    if $DAEMON $DAEMON_ARGS stop; then
 
52
      log_end_msg 0
 
53
    else
 
54
      log_end_msg 1
 
55
    fi
 
56
    ;;
 
57
  restart|force-reload)
 
58
    test "$ENABLED" = "true" || exit 1
 
59
    cd /var/run
 
60
    if $DAEMON $DAEMON_ARGS restart; then
 
61
      log_end_msg 0
 
62
    else
 
63
      log_end_msg 1
 
64
    fi
 
65
    ;;
 
66
  status)
 
67
    test "$ENABLED" = "true" || exit 0
 
68
    status_of_proc -p $PIDFILE $DAEMON nova-volume && exit 0 || exit $?
 
69
    ;;
 
70
  *)
 
71
    log_action_msg "Usage: /etc/init.d/nova-volume {start|stop|restart|force-reload|status}"
 
72
    exit 1
 
73
    ;;
 
74
esac
 
75
 
 
76
exit 0