summaryrefslogtreecommitdiffstats
path: root/debian/dpdk.init
blob: 01b478452741756de581aac3f211bb92036966a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh

### BEGIN INIT INFO
# Provides:          dpdk
# Required-Start:    $remote_fs $local_fs
# Required-Stop:     $remote_fs $local_fs
# Default-Start:     S
# Default-Stop:      0 1 6
# Short-Description: start dpdk runtime environment
### END INIT INFO

set -e

PATH="/sbin:/bin:/usr/bin"

[ -d /lib/dpdk ] || exit 0

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

error=0
case "$1" in
start)
    log_action_begin_msg "Starting DPDK environment" "dpdk"
    output=$(/lib/dpdk/dpdk-init start 2>&1) || error="$?"
    if [ ! -z "$output" ]; then
        echo "$output" | while read line; do
            log_action_cont_msg "$line"
        done
    fi
    log_action_end_msg $error
    exit $error
    ;;
stop)
    ;;
restart|force-reload)
    ;;
status)
    output=$(/lib/dpdk/dpdk-init --status 2>&1) || error="$?"
    if [ ! -z "$output" ]; then
        echo "$output" | while read line; do
            log_action_cont_msg "$line"
        done
    fi
    log_action_end_msg $error
    exit $error
    ;;
*)
    echo "Usage: $0 {start|stop|restart|force-reload|status}"
    exit 1
    ;;
esac

exit 0