| 1 | #!/sbin/sh |
|---|
| 2 | # |
|---|
| 3 | # Copyright 2005 William Wanders. All rights reserved. |
|---|
| 4 | # Use is subject to license terms. |
|---|
| 5 | # |
|---|
| 6 | # ident "@(#)openct-fabric 1.1 04/08/31 SMI" |
|---|
| 7 | # |
|---|
| 8 | # This script is used initialize and shutdown the OpenCT fabric |
|---|
| 9 | # |
|---|
| 10 | |
|---|
| 11 | case "$1" in |
|---|
| 12 | 'start') |
|---|
| 13 | # Create directory for OpenCT fabric |
|---|
| 14 | if [ ! -d /var/run/openct ] |
|---|
| 15 | then |
|---|
| 16 | mkdir -p /var/run/openct |
|---|
| 17 | fi |
|---|
| 18 | |
|---|
| 19 | # Startup the OpenCT fabric |
|---|
| 20 | if [ ! -f /var/run/openct/status ] |
|---|
| 21 | then |
|---|
| 22 | /usr/sbin/openct-control init |
|---|
| 23 | fi |
|---|
| 24 | |
|---|
| 25 | # Add sysevent handler for hotplug support |
|---|
| 26 | if syseventadm list \ |
|---|
| 27 | -v SUNW -p ddi -c EC_devfs -s ESC_devfs_devi_add \ |
|---|
| 28 | /usr/sbin/openct-hotplug '${di.path}' >/dev/null |
|---|
| 29 | then |
|---|
| 30 | echo "system eventhandler already added" |
|---|
| 31 | else |
|---|
| 32 | syseventadm add \ |
|---|
| 33 | -v SUNW -p ddi -c EC_devfs -s ESC_devfs_devi_add \ |
|---|
| 34 | /usr/sbin/openct-hotplug '${di.path}' |
|---|
| 35 | fi |
|---|
| 36 | ;; |
|---|
| 37 | 'stop') |
|---|
| 38 | # Remove sysevent handler for hotplug support |
|---|
| 39 | if syseventadm list \ |
|---|
| 40 | -v SUNW -p ddi -c EC_devfs -s ESC_devfs_devi_add \ |
|---|
| 41 | /usr/sbin/openct-hotplug '${di.path}' >/dev/null |
|---|
| 42 | then |
|---|
| 43 | syseventadm remove \ |
|---|
| 44 | -v SUNW -p ddi -c EC_devfs -s ESC_devfs_devi_add \ |
|---|
| 45 | /usr/sbin/openct-hotplug '${di.path}' |
|---|
| 46 | fi |
|---|
| 47 | |
|---|
| 48 | # Shutdown the OpenCT fabric |
|---|
| 49 | if [ -f /var/run/openct/status ] |
|---|
| 50 | then |
|---|
| 51 | /usr/sbin/openct-control shutdown |
|---|
| 52 | fi |
|---|
| 53 | |
|---|
| 54 | # Cleanup the OpenCT fabric directory |
|---|
| 55 | if [ -d /var/run/openct ] |
|---|
| 56 | then |
|---|
| 57 | rm -rf /var/run/openct |
|---|
| 58 | fi |
|---|
| 59 | ;; |
|---|
| 60 | 'status') |
|---|
| 61 | /usr/sbin/openct-control status |
|---|
| 62 | ;; |
|---|
| 63 | *) |
|---|
| 64 | echo "Usage: $0 { start | stop | status}" |
|---|
| 65 | exit 1 |
|---|
| 66 | ;; |
|---|
| 67 | esac |
|---|
| 68 | |
|---|
| 69 | exit $? |
|---|