⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 noflushd.postinst

📁 linux 系统控制硬盘旋转和停止的程序(spin down/up)
💻 POSTINST
字号:
#!/bin/shset -eCONFFILE=/etc/default/noflushdupdate_param() {		eval local old=\"'$'$1\"	eval local new=\"'$'new_$1\"		if test "$old" = "$new"; then		return	fi		if test -z "$old"; then		grep -Eq "^ *$1=" "$CONFFILE" || echo "$1=" >> "$CONFFILE"	fi	# Careful here! Both DISKS and PARAMS may contain '/' (or just about	# any other character. In order not to confuse ed, we use a delimiter	# for the regexp that very rarely occurs in path names.	printf "%%s?^ *$1=.*?$1=\"$new\"?\nw\nq\n" | ed -s "$CONFFILE"}		. /usr/share/debconf/confmoduleif test -e "$CONFFILE"; then	. "$CONFFILE"else	cat > "$CONFFILE" << EOF# This is a configuration file for /etc/init.d/noflushd.# Tune this file to suit your needs.  For a standard laptop setup,# you stand a good chance that simply commenting out the entries# for TIMEOUT, and DISKS will suffice.# Time in minutes before a disk is spun down. The disk is only spun# down after this much time has passed without any reads from the disk.TIMEOUT=# Disks to spin down. Noflushd currently only works with ide hard disks;# scsi disks require a kernel patch. You may spin down multiple disks by# listing them all here separated by spaces. If this variable is unset,# noflushd tries to auto-detect all disks on the system, and spins them# down using the default timeout given above.DISKS=# If you prefer to craft your own set of parameters to handle more complex# situations, uncomment this line and see noflushd(8) for details about the# parameters the daemon takes. Note that if this line is uncommented, the# TIMEOUT and DISKS lines above are ignored.#PARAMS="-r /dev/sdb -n 60,5 /dev/hda -t 15,default /dev/hdc"EOFfidb_get noflushd/timeoutnew_TIMEOUT="$RET"db_get noflushd/disksnew_DISKS="$RET"db_get noflushd/paramsnew_PARAMS="$RET"for i in TIMEOUT DISKS PARAMS; do	update_param "$i"donedb_stop# There seem to be versions of prerm around that fail to properly# stop the daemon. Try again here.if [ -x /etc/init.d/noflushd ]; then	if [ -x /usr/sbin/invoke-rc.d ]; then		invoke-rc.d noflushd stop || :	else		/etc/init.d/noflushd stop || :	fifi##DEBHELPER##

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -