Advertisement
jm2

opensm-launch

jm2
Apr 28th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Launch the necessary OpenSM daemons for systemd
  4. #
  5. # sysconfig: /etc/sysconfig/opensm
  6. # config: /etc/rdma/opensm.conf
  7. #
  8.  
  9. shopt -s nullglob
  10.  
  11. prog=/usr/sbin/opensm
  12. [ -f /etc/sysconfig/opensm ] && . /etc/sysconfig/opensm
  13.  
  14. [ -n "$PRIORITY" ] && prio="-p $PRIORITY"
  15.  
  16. if [ -z "$GUIDS" ]; then
  17.     CONFIGS=""
  18.     CONFIG_CNT=0
  19.     for conf in /etc/rdma/opensm.conf.[0-9]*; do
  20.         CONFIGS="$CONFIGS $conf"
  21.         let CONFIG_CNT++
  22.     done
  23. else
  24.     GUID_CNT=0
  25.     for guid in $GUIDS; do
  26.         let GUID_CNT++
  27.     done
  28. fi
  29. # Start opensm
  30. if [ -n "$GUIDS" ]; then
  31.     SUBNET_COUNT=0
  32.     for guid in $GUIDS; do
  33.         SUBNET_PREFIX=`printf "0xfe800000000000%02d" $SUBNET_COUNT`
  34.         (while true; do $prog $prio -g $guid --subnet_prefix $SUBNET_PREFIX; sleep 30; done) &
  35.         let SUBNET_COUNT++
  36.     done
  37. elif [ -n "$CONFIGS" ]; then
  38.     for config in $CONFIGS; do
  39.         (while true; do $prog $prio -F $config; sleep 30; done) &
  40.     done
  41. else
  42.     (while true; do $prog $prio; sleep 30; done) &
  43. fi
  44. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement