Bo's Oracle Station

查看: 1928|回复: 0

第27/28/29次:2015-12-7/9/11星期一/星期三/星期五

[复制链接]

75

主题

115

帖子

2772

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2772
发表于 2015-12-12 23:17:29 | 显示全部楼层 |阅读模式
第27/28/29次:2015-12-7/9/11星期一/星期三/星期五

  1. #!/bin/sh

  2. for i in {0..7}
  3. do
  4. losetup /dev/loop$i /mnt2/a$i.img
  5. done

  6. echo "NOW TEST"
  7. sleep 3

  8. for i in {0..7}
  9. do
  10. losetup /dev/loop$i
  11. done
复制代码
/etc/rc.d/init.d/rawdevices:
  1. #!/bin/bash
  2. #
  3. # rawdevices       This shell script assignes rawdevices to block devices
  4. #
  5. # chkconfig: 345 56 44
  6. # description: This scripts assignes raw devices to block devices \
  7. #              (such as hard drive partitions). This is for the use \
  8. #               of applications such as Oracle. You can set up the \
  9. #               raw device to block device mapping by editing \
  10. #               the file /etc/sysconfig/rawdevices.
  11. #
  12. # config: /etc/sysconfig/rawdevices

  13. [ -f /bin/raw ] || exit 0
  14. [ -f /etc/sysconfig/rawdevices ] || exit 0
  15. # Exit if the file just has the default comments.
  16. LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0

  17. . /etc/init.d/functions

  18. function assign_raw()
  19. {
  20.    LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices |
  21.    while read RAW BLOCK; do
  22.      if [ -n "$RAW" -a -n "$BLOCK" ]; then
  23.          rawdirname=${RAW%/*}
  24.          if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then
  25.            echo $"  Please correct your /etc/sysconfig/rawdevices:"
  26.            echo $"     rawdevices are now located in the directory /dev/raw/ "
  27.            echo $"  If the command 'raw' still refers to /dev/raw as a file."
  28.            echo $"   you'll have to upgrade your util-linux package"
  29.            exit 0
  30.          fi
  31.          if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then
  32.            echo $"  Please correct your /etc/sysconfig/rawdevices:"
  33.            echo $"     rawdevices are now located in the directory /dev/raw/ "
  34.            echo $"  If the command 'raw' still refers to /dev/raw as a file."
  35.            echo $"   you'll have to upgrade your util-linux package"
  36.            exit 0
  37.          fi

  38.        echo "           $RAW  -->   $BLOCK";
  39.        raw $RAW $BLOCK
  40.      fi
  41.    done
  42. }

  43. # See how we were called.
  44. case "$1" in
  45.   start)
  46.         # Assign devices
  47.         echo $"Assigning devices: "
  48.         assign_raw
  49.         <font color="Red">sleep 3
  50.         chown -R oracle:oinstall /dev/raw/
  51.         <font color="Black">echo $"done"</font></font>
  52.         ;;
  53.   stop)
  54.         # No action to be taken here
  55.         ;;

  56.   status)
  57.         ID=`id -u`
  58.         if [ $ID -eq 0 ]; then
  59.           raw -qa
  60.         else
  61.           echo $"You need to be root to use this command ! "
  62.         fi
  63.         ;;

  64.   restart|reload)
  65.         $0 start
  66.         ;;

  67.   *)
  68.         echo $"Usage: $0 {start|stop|status|restart}"
  69.         exit 1
  70. esac

  71. exit 0
复制代码



/etc/sysconfig/rawdevices:

  1. /dev/raw/raw7  /dev/sda7
  2. /dev/raw/raw8  /dev/sda8
  3. /dev/raw/raw9  /dev/sda9
  4. /dev/raw/raw10  /dev/sda10
  5. /dev/raw/raw11  /dev/sda11
  6. /dev/raw/raw12  /dev/sda12
  7. /dev/raw/raw13  /dev/sda13
  8. /dev/raw/raw14  /dev/sda14
  9. /dev/raw/raw15  /dev/sda15
  10. /dev/raw/raw16  /dev/loop9
  11. /dev/raw/raw17  /dev/loop8
  12. /dev/raw/raw18   /dev/loop7
  13. /dev/raw/raw19  /dev/loop6
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-1 08:05 , Processed in 0.038188 second(s), 24 queries .

快速回复 返回顶部 返回列表