当前位置: 首页 > 工具软件 > Flashcache > 使用案例 >

服务器系统启用flash,flashcache 安装,配置,随服务器启动 方法

李甫
2023-12-01

#! /bin/bash

#

#

network Bring up/down fc

#

# chkconfig: 2345 10 90

# description: Activates/Deactivates all fc

#

### BEGIN INIT INFO

# Provides: $fc

# Should-Start: iptables ip6tables

# Short-Description: Bring up/down fc

# Description: Bring up/down fc

### END INIT INFO

# Source function library.

. /etc/init.d/functions

# See how we were called.

case "$1" in

start)

# Check if /home is mounted

HOMEMOUNT=$(mount | grep test | sed 's/ .*//' | sed

's#.*/##' )

# Load module if not already loaded

if [[ ! "$(eval lsmod | grep "^flashcache")" ]];

then

modprobe flashcache

fi

# Mount flashcache /test if not already mounted

if [[ ! "$HOMEMOUNT" == "cachedev" ]]; then

umount /test

if [ ! -e /dev/mapper/cachedev ];

then

flashcache_load /dev/sdc

fi

mount /dev/mapper/cachedev

/test

fi

;;

stop)

# Check if /home is mounted

HOMEMOUNT=$(mount | grep test | sed 's/ .*//' | sed

's#.*/##' )

# Load module if not already loaded

if [[ ! "$(eval lsmod | grep "^flashcache")" ]];

then

modprobe flashcache

fi

# Mount flashcache /test if not already mounted

if [[ ! "$HOMEMOUNT" == "cachedev" ]]; then

umount /test

if [ ! -e /dev/mapper/cachedev ];

then

flashcache_load /dev/sdc

fi

mount /dev/mapper/cachedev

/test

fi

;;

status)

# Check if /home is mounted

HOMEMOUNT=$(mount | grep test | sed 's/ .*//' | sed

's#.*/##' )

# Load module if not already loaded

if [[ ! "$(eval lsmod | grep "^flashcache")" ]];

then

modprobe flashcache

fi

# Mount flashcache /test if not already mounted

if [[ ! "$HOMEMOUNT" == "cachedev" ]]; then

umount /test

if [ ! -e /dev/mapper/cachedev ];

then

flashcache_load /dev/sdc

fi

mount /dev/mapper/cachedev

/test

fi

;;

restart|reload|force-reload)

# Check if /home is mounted

HOMEMOUNT=$(mount | grep test | sed 's/ .*//' | sed

's#.*/##' )

# Load module if not already loaded

if [[ ! "$(eval lsmod | grep "^flashcache")" ]];

then

modprobe flashcache

fi

# Mount flashcache /test if not already mounted

if [[ ! "$HOMEMOUNT" == "cachedev" ]]; then

umount /test

if [ ! -e /dev/mapper/cachedev ];

then

flashcache_load /dev/sdc

fi

mount /dev/mapper/cachedev

/test

fi

;;

*)

echo $"Usage: $0

{start|stop|status|restart|reload|force-reload}"

exit 2

esac

 类似资料: