aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2004-10-12 01:00:13 +0000
committerHarald Hoyer <harald@redhat.com>2009-05-14 16:56:59 +0200
commitda1f0a03d1a9ae65f36102e71120a3cfe7dd432c (patch)
treec6b4080ee266c9fd4255e0cb1fba29ad5529dddc /rc.d
parent063bde81b8fcd430aa68312c80a514717b6ccd71 (diff)
downloadinitscripts-da1f0a03d1a9ae65f36102e71120a3cfe7dd432c.tar
initscripts-da1f0a03d1a9ae65f36102e71120a3cfe7dd432c.tar.gz
initscripts-da1f0a03d1a9ae65f36102e71120a3cfe7dd432c.tar.bz2
initscripts-da1f0a03d1a9ae65f36102e71120a3cfe7dd432c.tar.xz
initscripts-da1f0a03d1a9ae65f36102e71120a3cfe7dd432c.zip
return of rawdevices stuff
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/init.d/rawdevices80
1 files changed, 80 insertions, 0 deletions
diff --git a/rc.d/init.d/rawdevices b/rc.d/init.d/rawdevices
new file mode 100755
index 00000000..67954d17
--- /dev/null
+++ b/rc.d/init.d/rawdevices
@@ -0,0 +1,80 @@
+#!/bin/bash
+#
+# rawdevices This shell script assignes rawdevices to block devices
+#
+# chkconfig: 345 56 44
+# description: This scripts assignes raw devices to block devices \
+# (such as hard drive partitions). This is for the use \
+# of applications such as Oracle. You can set up the \
+# raw device to block device mapping by editing \
+# the file /etc/sysconfig/rawdevices. Note that the use \
+# of raw devices is deprecated, and applications should \
+# open regular block devices with O_DIRECT instead.
+#
+# config: /etc/sysconfig/rawdevices
+
+[ -f /usr/bin/raw ] || exit 0
+[ -f /etc/sysconfig/rawdevices ] || exit 0
+# Exit if the file just has the default comments.
+LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0
+
+. /etc/init.d/functions
+
+function assign_raw()
+{
+ LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices |
+ while read RAW BLOCK; do
+ if [ -n "$RAW" -a -n "$BLOCK" ]; then
+ rawdirname=${RAW%/*}
+ if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then
+ echo $" Please correct your /etc/sysconfig/rawdevices:"
+ echo $" rawdevices are now located in the directory /dev/raw/ "
+ echo $" If the command 'raw' still refers to /dev/raw as a file."
+ echo $" you'll have to upgrade your util-linux package"
+ exit 0
+ fi
+ if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then
+ echo $" Please correct your /etc/sysconfig/rawdevices:"
+ echo $" rawdevices are now located in the directory /dev/raw/ "
+ echo $" If the command 'raw' still refers to /dev/raw as a file."
+ echo $" you'll have to upgrade your util-linux package"
+ exit 0
+ fi
+
+ echo " $RAW --> $BLOCK";
+ raw $RAW $BLOCK
+ fi
+ done
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ # Assign devices
+ echo $"Assigning devices: "
+ assign_raw
+ echo $"done"
+ ;;
+ stop)
+ # No action to be taken here
+ ;;
+
+ status)
+ ID=`id -u`
+ if [ $ID -eq 0 ]; then
+ raw -qa
+ else
+ echo $"You need to be root to use this command ! "
+ fi
+ ;;
+
+ restart|reload)
+ $0 start
+ ;;
+
+ *)
+ echo $"Usage: $0 {start|stop|status|restart}"
+ exit 1
+esac
+
+exit 0