Re: sysctl defaults

Adam Heath (adam.heath@usa.net)
Mon, 30 Mar 1998 00:28:21 -0500 (EST)


On Mon, 30 Mar 1998, Garst R. Reese wrote:

> With the growing number of sysctl options, it seems to me that one could
> make some rather disastrous errors trying to tune the kernel.
> A shell script that would restore everything to the defaults would be
> quite useful, along with a boot option to do the same. The shell script
> could contain comments to explain the options as well.

Here you go. No frills, no chills save/restore sysctl script.

---
#!/bin/sh
sdir=/procsave
pdir=/proc/sys
function doit(){
	echo $*
	eval $*
}
if [ ! -d "$sdir" ];then
	doit mkdir $sdir
fi
case "$1" in
	"save")
		rm $sdir/* -r
		cd $pdir
		for dir in `find -type d ! -name .` ;do
			doit mkdir $sdir/$dir
		done
		for file in `find -type f ! -name .` ;do
			doit cp $pdir/$file $sdir/$file 
		done
		;;
	"restore")
		cd $pdir
		for file in `find -type f ! -name .` ;do
			if [ -e $sdir/$file ];then
				doit cp $sdir/$file $pdir/$file 2>/dev/null
			fi
		done
		;;
esac
---
call as 'save_proc_sys {save/restore}'

Adam

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu