summaryrefslogtreecommitdiff
path: root/init_scripts/img_server
blob: de09930d191851bcbf0e64a06c7a8bf20842ac33 (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
#!/bin/sh
#
# description: a server for the image archive
# chkconfig: 2345 90 50
#
# Make init function library available
. /etc/init.d/functions

prog=SimpleHTTPServer

# Start the service
start() {
        echo "Starting $prog"
        cd /archive/images
        /usr/bin/python -m SimpleHTTPServer &
}
# Stop the service
stop()  {
        echo "Stopping $prog"
        pid=`ps aux|awk '/[S]impleHTTPServer/ {print $2}'`
        kill "$pid"
}

### Main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac
exit 0