Red Hat ENTERPRISE LINUX 5 - GLOBAL FILE SYSTEM 2 Manual page 41

Hide thumbs Also See for ENTERPRISE LINUX 5 - GLOBAL FILE SYSTEM 2:
Table of Contents

Advertisement

The following script is an example of a custom init script. This script performs a bind mount of two
directories onto two directories of a GFS2 filesystem. In this example, there is an existing GFS2 mount
point at /mnt/gfs2a, which is mounted when the GFS2 init script runs, after cluster startup.
In this example script, the values of the chkconfig statement indicate the following:
• 345 indicates the run levels that the script will be started in
• 29 is the start priority, which in this case indicates that the script will run at startup time after the
GFS2 init script, which has a start priority of 26
• 73 is the stop priority, which in this case indicates that the script will be stopped during shutdown
before the GFS2 script, which has a stop priority of 74
The start and stop values indicate that you can manually perform the indicated action by executing a
service start and a service stop command. For example, if the script is named fredwilma,
then you can execute service fredwilma start.
This script should be put in the /etc/init.d directory with the same permissions as the other scripts
in that directory. You can then execute a chkconfig on command to link the script to the indicated
run levels. For example, if the script is named fredwilma, then you can execute chkconfig
fredwilma on.
#!/bin/bash
#
# chkconfig: 345 29 73
# description: mount/unmount my custom bind mounts onto a gfs2 subdirectory
#
#
### BEGIN INIT INFO
# Provides:
### END INIT INFO
. /etc/init.d/functions
case "$1" in
start)
# In this example, fred and wilma want their home directories
# bind-mounted over the gfs2 directory /mnt/gfs2a, which has
# been mounted as /mnt/gfs2a
mkdir -p /mnt/gfs2a/home/fred &> /dev/null
mkdir -p /mnt/gfs2a/home/wilma &> /dev/null
/bin/mount --bind /mnt/gfs2a/home/fred /home/fred
/bin/mount --bind /mnt/gfs2a/home/wilma /home/wilma
;;
stop)
/bin/umount /mnt/gfs2a/home/fred
/bin/umount /mnt/gfs2a/home/wilma
;;
status)
;;
restart)
$0 stop
$0 start
;;
Bind Mounts and File System Mount Order
31

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 5 - GLOBAL FILE SYSTEM 2 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Global file system 2

Table of Contents