Revision d3c19cc9 src/sunstone/bin/sunstone-server

View differences:

src/sunstone/bin/sunstone-server
32 32
PORT="4567"
33 33
HOST="127.0.0.1"
34 34

  
35
usage() {
36
 echo
37
 echo "Usage: sunstone-server [-H host] [-p port]"
38
 echo
39
 echo "-H: Host for the Sunstone server, default value: localhost"
40
 echo "-p: Port for incoming connections, default value: 4567"
41
}
42

  
35 43
setup()
36 44
{
37 45

  
......
92 100
  # Kill the sunstone daemon
93 101
  kill -INT `cat $SUNSTONE_PID` &> /dev/null
94 102

  
103
  # Remove pid files
104
  rm -f $SUNSTONE_LOCK_FILE &> /dev/null
105

  
95 106
  echo "sunstone-server stopped"
96 107
}
97 108

  
98
while getopts "p:h:" OPTION
109
while getopts "p:H:" OPTION
99 110
do
100 111
  case $OPTION in
101
    p)  PORT=$OPTARG;;
102
    h)  HOST=$OPTARG;;
103
    \?) echo "Invalid option: -$OPTARG" >&2; exit 3 ;;
112
    p) PORT=$OPTARG;;
113
    H) HOST=$OPTARG;;
114
    *) usage; exit 3;;
104 115
  esac
105 116
done
106 117

  
107 118
shift $((OPTIND-1))
108 119

  
109 120
case "$1" in
110
  start)
111
  setup
112
  start
113
  ;;
114
  stop)
115
  stop
116
  ;;
117
  *)
118
  echo "Usage: sunstone {start|stop}" >&2
119
  exit 3
120
  ;;
121
  start) setup; start;;
122
  stop)  stop;;
123
  *)     usage; exit 3;;
121 124
esac

Also available in: Unified diff