]> git.proxmox.com Git - ovs.git/blame - utilities/ovs-ctl.in
Fix renaming: libopenvswitch-2.14.so.0.0.90 -> libopenvswitch-2.15.so.0.0.0
[ovs.git] / utilities / ovs-ctl.in
CommitLineData
43bb5f82 1#! /bin/sh
34d4f74d 2# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Nicira, Inc.
43bb5f82
BP
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at:
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16case $0 in
17 */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
18 *) dir0=./ ;;
19esac
d422c118 20. "$dir0/ovs-lib" || exit 1
43bb5f82
BP
21
22for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do
23 case :$PATH: in
24 *:$dir:*) ;;
25 *) PATH=$PATH:$dir ;;
26 esac
27done
28
29## ----- ##
30## start ##
31## ----- ##
32
0a69a5e4 33insert_mod_if_required () {
15117123
AC
34 ## This takes care of inserting any required kernel modules
35 ovs_kmod_ctl insert
43bb5f82
BP
36}
37
6ff72646
GS
38set_hostname () {
39 # 'hostname -f' needs network connectivity to work. So we should
40 # call this only after ovs-vswitchd is running.
dd091e16
YZ
41 if test X$FULL_HOSTNAME = Xyes; then
42 hn="$(hostname -f)" || hn="$(uname -n)"
43 else
44 hn="$(uname -n)"
298115b9 45 fi
2221e8b0
DA
46 # Set the hostname if it wasn't set before
47 ovs_vsctl add Open_vSwitch . external-ids hostname="$hn"
6ff72646
GS
48}
49
43bb5f82
BP
50set_system_ids () {
51 set ovs_vsctl set Open_vSwitch .
52
40c23a57 53 OVS_VERSION=`ovs-vswitchd --version | awk '/Open vSwitch/{print $NF}'`
43bb5f82
BP
54 set "$@" ovs-version="$OVS_VERSION"
55
56 case $SYSTEM_ID in
57 random)
58 id_file=$etcdir/system-id.conf
59 uuid_file=$etcdir/install_uuid.conf
60 if test -e "$id_file"; then
61 SYSTEM_ID=`cat "$id_file"`
62 elif test -e "$uuid_file"; then
63 # Migrate from old file name.
64 . "$uuid_file"
65 SYSTEM_ID=$INSTALLATION_UUID
741fd33e 66 run_as_ovsuser touch "$id_file"
43bb5f82
BP
67 echo "$SYSTEM_ID" > "$id_file"
68 elif SYSTEM_ID=`uuidgen`; then
741fd33e 69 run_as_ovsuser touch "$id_file"
43bb5f82
BP
70 echo "$SYSTEM_ID" > "$id_file"
71 else
72 log_failure_msg "missing uuidgen, could not generate system ID"
73 fi
74 ;;
75
76 '')
77 log_failure_msg "system ID not configured, please use --system-id"
78 ;;
79
80 *)
81 ;;
82 esac
83 set "$@" external-ids:system-id="\"$SYSTEM_ID\""
84
34d4f74d
RW
85 set "$@" external-ids:rundir="\"$rundir\""
86
43bb5f82
BP
87 if test X"$SYSTEM_TYPE" != X; then
88 set "$@" system-type="\"$SYSTEM_TYPE\""
89 else
90 log_failure_msg "no default system type, please use --system-type"
91 fi
92
93 if test X"$SYSTEM_VERSION" != X; then
94 set "$@" system-version="\"$SYSTEM_VERSION\""
95 else
96 log_failure_msg "no default system version, please use --system-version"
97 fi
98
99 action "Configuring Open vSwitch system IDs" "$@" $extra_ids
100}
101
522839ab 102check_force_cores () {
43bb5f82 103 if test X"$FORCE_COREFILES" = Xyes; then
a5d873f4 104 ulimit -c 67108864
43bb5f82 105 fi
522839ab 106}
43bb5f82 107
54b21db7
TLSC
108del_transient_ports () {
109 for port in `ovs-vsctl --bare -- --columns=name find port other_config:transient=true`; do
110 ovs_vsctl -- del-port "$port"
111 done
112}
113
7fc28c50 114do_start_ovsdb () {
522839ab 115 check_force_cores
43bb5f82
BP
116
117 if daemon_is_running ovsdb-server; then
c707d418 118 log_success_msg "ovsdb-server is already running"
43bb5f82 119 else
c707d418 120 # Create initial database or upgrade database schema.
2db1b5d8 121 upgrade_db $DB_FILE $DB_SCHEMA || return 1
c707d418
JP
122
123 # Start ovsdb-server.
124 set ovsdb-server "$DB_FILE"
b4e8d170
BP
125 for db in $EXTRA_DBS; do
126 case $db in
127 /*) ;;
128 *) db=$dbdir/$db ;;
129 esac
130
131 if test ! -f "$db"; then
132 log_warning_msg "$db (from \$EXTRA_DBS) does not exist."
133 elif ovsdb-tool db-version "$db" >/dev/null; then
134 set "$@" "$db"
135 else
136 log_warning_msg "$db (from \$EXTRA_DBS) cannot be read as a database (see error message above)"
137 fi
138 done
81d2f75c
AA
139 if test X"$SELF_CONFINEMENT" = Xno; then
140 set "$@" --no-self-confinement
141 fi
c707d418
JP
142 set "$@" -vconsole:emer -vsyslog:err -vfile:info
143 set "$@" --remote=punix:"$DB_SOCK"
4206b80f
HM
144 set "$@" --private-key=db:Open_vSwitch,SSL,private_key
145 set "$@" --certificate=db:Open_vSwitch,SSL,certificate
146 set "$@" --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert
9ab5390d 147 [ "$OVS_USER" != "" ] && set "$@" --user "$OVS_USER"
fce20b8b 148 [ "$OVSDB_SERVER_OPTIONS" != "" ] && set "$@" $OVSDB_SERVER_OPTIONS
9ab5390d 149
c707d418 150 start_daemon "$OVSDB_SERVER_PRIORITY" "$OVSDB_SERVER_WRAPPER" "$@" \
d0c06099 151 || return 1
43bb5f82 152
c707d418
JP
153 # Initialize database settings.
154 ovs_vsctl -- init -- set Open_vSwitch . db-version="$schemaver" \
155 || return 1
156 set_system_ids || return 1
157 if test X"$DELETE_BRIDGES" = Xyes; then
43bb5f82 158 for bridge in `ovs_vsctl list-br`; do
c6f4d298 159 ovs_vsctl del-br $bridge
43bb5f82 160 done
c707d418 161 fi
54b21db7
TLSC
162 if test X"$DELETE_TRANSIENT_PORTS" = Xyes; then
163 del_transient_ports
164 fi
43bb5f82 165 fi
522839ab
JP
166}
167
7fc28c50
AC
168start_ovsdb() {
169 if test X"$OVSDB_SERVER" = Xyes; then
452a1f59 170 do_start_ovsdb || return 1
7fc28c50 171 fi
452a1f59 172 return 0
7fc28c50
AC
173}
174
1259a0c4 175add_managers () {
70738f0b
DB
176 # Tell ovsdb-server to connect to the remote managers. If ovs-vswitchd
177 # is not finished configuring, it may mean that remote managers will
178 # see more churn in the database at startup or restart. (For example,
179 # managers may briefly see empty datapath-id or ofport columns for
180 # records that exist at startup.). However, the alternative is a
181 # 'bricked' system, so we allow database connectivity regardless.
0cfd47f9 182 if test X"$OVSDB_SERVER" = Xyes || test X"$OVS_VSWITCHD" = Xyes; then
70738f0b 183 if daemon_is_running ovsdb-server; then
0cfd47f9
AC
184 action "Enabling remote OVSDB managers" \
185 ovs-appctl -t ovsdb-server ovsdb-server/add-remote \
186 db:Open_vSwitch,Open_vSwitch,manager_options
187 fi
188 fi
1259a0c4
GS
189}
190
7fc28c50 191do_start_forwarding () {
522839ab
JP
192 check_force_cores
193
194 insert_mod_if_required || return 1
43bb5f82
BP
195
196 if daemon_is_running ovs-vswitchd; then
c707d418 197 log_success_msg "ovs-vswitchd is already running"
43bb5f82 198 else
c707d418 199 # Increase the limit on the number of open file descriptors.
991d922c 200 # On Linux, ovs-vswitchd needs about three file descriptors
7a6cf343
AW
201 # per bridge and "n-handler-threads" file descriptors per bridge
202 # port, so this allows a very large number of bridges and ports.
203 MAXFD=65535
bfe4277e
TG
204 if [ $(ulimit -n) -lt $MAXFD ]; then
205 ulimit -n $MAXFD
206 fi
c707d418 207
81d2f75c
AA
208 # Start ovs-vswitchd.
209 set ovs-vswitchd unix:"$DB_SOCK"
210 set "$@" -vconsole:emer -vsyslog:err -vfile:info
211 if test X"$MLOCKALL" != Xno; then
212 set "$@" --mlockall
213 fi
214 if test X"$SELF_CONFINEMENT" = Xno; then
215 set "$@" --no-self-confinement
216 fi
9ab5390d 217 [ "$OVS_USER" != "" ] && set "$@" --user "$OVS_USER"
fce20b8b 218 [ "$OVS_VSWITCHD_OPTIONS" != "" ] &&set "$@" $OVS_VSWITCHD_OPTIONS
9ab5390d 219
452a1f59
MC
220 start_daemon "$OVS_VSWITCHD_PRIORITY" "$OVS_VSWITCHD_WRAPPER" "$@" ||
221 return 1
43bb5f82
BP
222 fi
223}
224
7fc28c50
AC
225start_forwarding () {
226 if test X"$OVS_VSWITCHD" = Xyes; then
452a1f59 227 do_start_forwarding || return 1
7fc28c50 228 fi
6ff72646 229 set_hostname &
452a1f59 230 return 0
7fc28c50
AC
231}
232
bdddc715 233start_ovs_ipsec () {
fe5ff26a
MG
234 if test X$RESTART_IKE_DAEMON = Xno; then
235 no_restart="--no-restart-ike-daemon"
236 fi
237
bdddc715
QX
238 ${datadir}/scripts/ovs-monitor-ipsec \
239 --pidfile=${rundir}/ovs-monitor-ipsec.pid \
240 --ike-daemon=$IKE_DAEMON \
fe5ff26a 241 $no_restart \
bdddc715
QX
242 --log-file --detach --monitor unix:${rundir}/db.sock || return 1
243 return 0
244}
245
43bb5f82
BP
246## ---- ##
247## stop ##
248## ---- ##
249
522839ab 250stop_ovsdb () {
7fc28c50
AC
251 if test X"$OVSDB_SERVER" = Xyes; then
252 stop_daemon ovsdb-server
253 fi
522839ab
JP
254}
255
256stop_forwarding () {
7fc28c50
AC
257 if test X"$OVS_VSWITCHD" = Xyes; then
258 stop_daemon ovs-vswitchd
259 fi
43bb5f82
BP
260}
261
bdddc715 262stop_ovs_ipsec () {
409c35a2 263 stop_daemon ovs-monitor-ipsec
bdddc715
QX
264}
265
b3a375f2
BP
266## --------------- ##
267## enable-protocol ##
268## --------------- ##
269
270enable_protocol () {
b053c7c1
BP
271 # Translate the protocol name to a number, because "iptables -n -L" prints
272 # some protocols by name (despite the -n) and therefore we need to look for
273 # both forms.
274 #
275 # (iptables -S output is more uniform but old iptables doesn't have it.)
276 protonum=`grep "^$PROTOCOL[ ]" /etc/protocols | awk '{print $2}'`
277 if expr X"$protonum" : X'[0-9]\{1,\}$' > /dev/null; then :; else
278 log_failure_msg "unknown protocol $PROTOCOL"
279 return 1
280 fi
281
b3a375f2 282 name=$PROTOCOL
b053c7c1
BP
283 match="(\$2 == \"$PROTOCOL\" || \$2 == $protonum)"
284 insert="iptables -I INPUT -p $PROTOCOL"
b3a375f2 285 if test X"$DPORT" != X; then
b3a375f2 286 name="$name to port $DPORT"
b053c7c1
BP
287 match="$match && /dpt:$DPORT/"
288 insert="$insert --dport $DPORT"
b3a375f2
BP
289 fi
290 if test X"$SPORT" != X; then
b3a375f2 291 name="$name from port $SPORT"
b053c7c1
BP
292 match="$match && /spt:$SPORT/"
293 insert="$insert --sport $SPORT"
b3a375f2 294 fi
b3a375f2
BP
295 insert="$insert -j ACCEPT"
296
b053c7c1
BP
297 if (iptables -n -L INPUT) >/dev/null 2>&1; then
298 if iptables -n -L INPUT | awk "$match { n++ } END { exit n == 0 }"
299 then
300 # There's already a rule for this protocol. Don't override it.
301 log_success_msg "iptables already has a rule for $name, not explicitly enabling"
302 else
303 action "Enabling $name with iptables" $insert
304 fi
b3a375f2 305 elif (iptables --version) >/dev/null 2>&1; then
b3a375f2 306 action "cannot list iptables rules, not adding a rule for $name"
2ae9d860
BP
307 else
308 action "iptables binary not installed, not adding a rule for $name"
b3a375f2
BP
309 fi
310}
311
43bb5f82
BP
312## ---- ##
313## main ##
314## ---- ##
315
316set_defaults () {
317 SYSTEM_ID=
318
298115b9
HZ
319 FULL_HOSTNAME=yes
320
43bb5f82 321 DELETE_BRIDGES=no
54b21db7 322 DELETE_TRANSIENT_PORTS=no
43bb5f82
BP
323
324 DAEMON_CWD=/
325 FORCE_COREFILES=yes
326 MLOCKALL=yes
81d2f75c 327 SELF_CONFINEMENT=yes
48458307 328 MONITOR=yes
9ab5390d 329 OVS_USER=
7fc28c50
AC
330 OVSDB_SERVER=yes
331 OVS_VSWITCHD=yes
43bb5f82
BP
332 OVSDB_SERVER_PRIORITY=-10
333 OVS_VSWITCHD_PRIORITY=-10
d0c06099
BP
334 OVSDB_SERVER_WRAPPER=
335 OVS_VSWITCHD_WRAPPER=
fce20b8b
TR
336 OVSDB_SERVER_OPTIONS=
337 OVS_VSWITCHD_OPTIONS=
43bb5f82 338
f973f2af 339 DB_FILE=$dbdir/conf.db
43bb5f82
BP
340 DB_SOCK=$rundir/db.sock
341 DB_SCHEMA=$datadir/vswitch.ovsschema
b4e8d170 342 EXTRA_DBS=
43bb5f82 343
b3a375f2
BP
344 PROTOCOL=gre
345 DPORT=
346 SPORT=
347
bdddc715 348 IKE_DAEMON=
fe5ff26a 349 RESTART_IKE_DAEMON=yes
bdddc715 350
a685eb5a
GS
351 type_file=$etcdir/system-type.conf
352 version_file=$etcdir/system-version.conf
353
354 if test -e "$type_file" ; then
355 SYSTEM_TYPE=`cat $type_file`
356 SYSTEM_VERSION=`cat $version_file`
c60d6b09 357 elif test -e "@sysconfdir@/os-release"; then
2c96044f
BP
358 SYSTEM_TYPE=`. '@sysconfdir@/os-release' && echo "$ID"`
359 SYSTEM_VERSION=`. '@sysconfdir@/os-release' && echo "$VERSION_ID"`
a685eb5a 360 elif (lsb_release --id) >/dev/null 2>&1; then
43bb5f82
BP
361 SYSTEM_TYPE=`lsb_release --id -s`
362 system_release=`lsb_release --release -s`
363 system_codename=`lsb_release --codename -s`
364 SYSTEM_VERSION="${system_release}-${system_codename}"
365 else
366 SYSTEM_TYPE=unknown
367 SYSTEM_VERSION=unknown
368 fi
369}
370
371usage () {
372 set_defaults
373 cat <<EOF
374$0: controls Open vSwitch daemons
375usage: $0 [OPTIONS] COMMAND
376
377This program is intended to be invoked internally by Open vSwitch startup
378scripts. System administrators should not normally invoke it directly.
379
380Commands:
61c7478a
TR
381 start start Open vSwitch daemons
382 stop stop Open vSwitch daemons
383 restart stop and start Open vSwitch daemons
384 status check whether Open vSwitch daemons are running
385 version print versions of Open vSwitch daemons
386 load-kmod insert modules if not already present
387 force-reload-kmod save OVS network device state, stop OVS, unload kernel
388 module, reload kernel module, start OVS, restore state
389 enable-protocol enable protocol specified in options with iptables
390 delete-transient-ports delete transient (other_config:transient=true) ports
bdddc715
QX
391 start-ovs-ipsec start Open vSwitch ipsec daemon
392 stop-ovs-ipsec stop Open vSwitch ipsec daemon
61c7478a 393 help display this help message
43bb5f82 394
a4175433 395One of the following options is required for "start", "restart" and "force-reload-kmod":
43bb5f82
BP
396 --system-id=UUID set specific ID to uniquely identify this system
397 --system-id=random use a random but persistent UUID to identify this system
398
a4175433 399Other important options for "start", "restart" and "force-reload-kmod":
43bb5f82
BP
400 --system-type=TYPE set system type (e.g. "XenServer")
401 --system-version=VERSION set system version (e.g. "5.6.100-39265p")
402 --external-id="key=value"
403 add given key-value pair to Open_vSwitch external-ids
404 --delete-bridges delete all bridges just before starting ovs-vswitchd
9ab5390d 405 --ovs-user="user[:group]" pass the --user flag to ovs daemons
43bb5f82 406
a4175433 407Less important options for "start", "restart" and "force-reload-kmod":
9fc47ed7
BP
408 --daemon-cwd=DIR set working dir for OVS daemons (default: $DAEMON_CWD)
409 --no-force-corefiles do not force on core dumps for OVS daemons
410 --no-mlockall do not lock all of ovs-vswitchd into memory
411 --ovsdb-server-priority=NICE set ovsdb-server's niceness (default: $OVSDB_SERVER_PRIORITY)
412 --ovs-vswitchd-priority=NICE set ovs-vswitchd's niceness (default: $OVS_VSWITCHD_PRIORITY)
298115b9 413 --no-full-hostname set short hostname instead of full hostname
9fc47ed7 414
a4175433 415Debugging options for "start", "restart" and "force-reload-kmod":
d0c06099 416 --ovsdb-server-wrapper=WRAPPER
d0c06099
BP
417 --ovs-vswitchd-wrapper=WRAPPER
418 run specified daemon under WRAPPER (either 'valgrind' or 'strace')
419
43bb5f82
BP
420File location options:
421 --db-file=FILE database file name (default: $DB_FILE)
422 --db-sock=SOCKET JSON-RPC socket name (default: $DB_SOCK)
423 --db-schema=FILE database schema file name (default: $DB_SCHEMA)
424
9fc47ed7 425Options for "enable-protocol":
b3a375f2
BP
426 --protocol=PROTOCOL protocol to enable with iptables (default: gre)
427 --sport=PORT source port to match (for tcp or udp protocol)
428 --dport=PORT ddestination port to match (for tcp or udp protocol)
429
bdddc715
QX
430Option for "start-ovs-ipsec":
431 --ike-daemon=IKE_DAEMON
432 the IKE daemon for ipsec tunnels (either libreswan or strongswan)
fe5ff26a
MG
433 --no-restart-ike-daemon
434 do not restart the IKE daemon on startup
bdddc715 435
43bb5f82
BP
436Other options:
437 -h, --help display this help message
438 -V, --version display version information
439
440Default directories with "configure" option and environment variable override:
f973f2af
BP
441 logs: @LOGDIR@ (--with-logdir, OVS_LOGDIR)
442 pidfiles and sockets: @RUNDIR@ (--with-rundir, OVS_RUNDIR)
443 conf.db: @DBDIR@ (--with-dbdir, OVS_DBDIR)
43bb5f82
BP
444 system configuration: @sysconfdir@ (--sysconfdir, OVS_SYSCONFDIR)
445 data files: @pkgdatadir@ (--pkgdatadir, OVS_PKGDATADIR)
446 user binaries: @bindir@ (--bindir, OVS_BINDIR)
447 system binaries: @sbindir@ (--sbindir, OVS_SBINDIR)
448
449Please report bugs to bugs@openvswitch.org (see REPORTING-BUGS for details).
450EOF
451
452 exit 0
453}
454
455set_option () {
456 var=`echo "$option" | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
457 eval set=\${$var+yes}
458 eval old_value=\$$var
459 if test X$set = X || \
460 (test $type = bool && \
461 test X"$old_value" != Xno && test X"$old_value" != Xyes); then
462 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
463 return
464 fi
465 eval $var=\$value
466}
467
9fc47ed7
BP
468daemons () {
469 echo ovsdb-server ovs-vswitchd
9fc47ed7
BP
470}
471
43bb5f82
BP
472set_defaults
473extra_ids=
474command=
475for arg
476do
477 case $arg in
478 -h | --help)
479 usage
480 ;;
481 -V | --version)
8a07709c 482 echo "$0 (Open vSwitch) $VERSION"
43bb5f82
BP
483 exit 0
484 ;;
485 --external-id=*)
486 value=`expr X"$arg" : 'X[^=]*=\(.*\)'`
487 case $value in
488 *=*)
489 extra_ids="$extra_ids external-ids:$value"
490 ;;
491 *)
492 echo >&2 "$0: --external-id argument not in the form \"key=value\""
493 exit 1
494 ;;
495 esac
496 ;;
497 --[a-z]*=*)
498 option=`expr X"$arg" : 'X--\([^=]*\)'`
499 value=`expr X"$arg" : 'X[^=]*=\(.*\)'`
500 type=string
501 set_option
502 ;;
503 --no-[a-z]*)
504 option=`expr X"$arg" : 'X--no-\(.*\)'`
505 value=no
506 type=bool
507 set_option
508 ;;
509 --[a-z]*)
510 option=`expr X"$arg" : 'X--\(.*\)'`
511 value=yes
512 type=bool
513 set_option
514 ;;
515 -*)
516 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
517 exit 1
518 ;;
519 *)
520 if test X"$command" = X; then
521 command=$arg
522 else
523 echo >&2 "$0: exactly one non-option argument required (use --help for help)"
524 exit 1
525 fi
526 ;;
527 esac
528done
529case $command in
530 start)
9fc789b9 531 start_ovsdb || exit 1
452a1f59 532 start_forwarding || exit 1
1259a0c4 533 add_managers
43bb5f82
BP
534 ;;
535 stop)
522839ab
JP
536 stop_forwarding
537 stop_ovsdb
43bb5f82 538 ;;
a4175433
GS
539 restart)
540 restart
541 ;;
43bb5f82 542 status)
9fc47ed7
BP
543 rc=0
544 for daemon in `daemons`; do
545 daemon_status $daemon || rc=$?
546 done
547 exit $rc
43bb5f82
BP
548 ;;
549 version)
9fc47ed7
BP
550 for daemon in `daemons`; do
551 $daemon --version
552 done
43bb5f82
BP
553 ;;
554 force-reload-kmod)
5a0e4aec 555 force_reload_kmod
43bb5f82 556 ;;
da3db88f
SH
557 load-kmod)
558 insert_mod_if_required
559 ;;
b3a375f2
BP
560 enable-protocol)
561 enable_protocol
562 ;;
61c7478a
TR
563 delete-transient-ports)
564 del_transient_ports
565 ;;
bdddc715
QX
566 start-ovs-ipsec)
567 start_ovs_ipsec
568 ;;
569 stop-ovs-ipsec)
570 stop_ovs_ipsec
571 ;;
43bb5f82
BP
572 help)
573 usage
574 ;;
575 '')
576 echo >&2 "$0: missing command name (use --help for help)"
577 exit 1
578 ;;
579 *)
580 echo >&2 "$0: unknown command \"$command\" (use --help for help)"
581 exit 1
582 ;;
583esac