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

📄 makefuncs.sh

📁 mmstatd包含一个 C库和服务器
💻 SH
字号:
#!/bin/sh# $Id: makefuncs.sh,v 1.1.1.1 2002/12/11 10:12:36 mmondor Exp $PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"show(){	echo "$@"	$@}killbin(){	echo "	Making sure $1 binary is not running"	pid=`ps axo pid,ucomm | grep $1 | awk '{print $1}'`	if [ ! -z "$pid" ]; then		kill $pid 2>/dev/null	fi}startbin(){	echo "	Starting $1 binary"	$MMPREFIX/sbin/$1 $2 >/dev/null}makebin(){	echo	echo "	Building $1"	./makepart.sh}clean(){	echo	echo "	Cleaning $1"	./makepart.sh clean}instbin(){	f2="$MMPREFIX/sbin/$1"	instdir "$MMPREFIX/sbin"	echo "	Installing $1 binary as $f2"	cp -f "$1" "$f2"	if [ -z "$3" ]; then		chown $MMDEFAULTUSER.$MMDEFAULTGROUP "$f2"	else		chown $MMDEFAULTUSER.$3 "$f2"	fi	if [ -z "$2" ]; then		chmod 755 "$f2"	else		chmod $2 "$f2"	fi	ls -l "$f2"}instconf(){	f2="$MMCONFDIR/$1"	instdir "$MMCONFDIR"	if [ ! -f "$f2" ]; then		echo "	Installing $1 configuration file as $f2"		cp "$1" "$f2"	else		echo "	Preserving existing $f2 configuration file"	fi	if [ -z "$3" ]; then		chown $MMDEFAULTUSER.$MMDEFAULTGROUP "$f2"	else		chown $MMDEFAULTUSER.$3 "$f2"	fi	if [ -z "$2" ]; then		chmod 644 "$f2"	else		chmod $2 "$f2" 	fi	ls -l "$f2"}instman(){	f2="$MMPREFIX/man/man$2/$1"	instdir "$MMPREFIX/man/man$2"	echo "	Installing $1 man page as $f2"	cp "$1" "$f2"	chown $MMDEFAULTUSER.$MMDEFAULTGROUP "$f2"	chmod 644 "$f2"	ls -l "$f2"}instdir(){	if [ ! -d "$1" ]; then		echo "	Creating $1 directory"		mkdir "$1"	else		echo "	Preserving existing $1 directory"	fi	if [ -z "$4" ]; then g=$MMDEFAULTGROUP; else g=$4; fi	if [ -z "$3" ]; then o=$MMDEFAULTUSER; else o=$3; fi	chown $o.$g "$1"	if [ -z "$2" ]; then		chmod 755 "$1"	else		chmod $2 "$1"	fi	ls -ld "$1"}instgroup(){	g=`grep "$1:" /etc/group`	if [ -z "$g" ]; then		echo "	Creating group $1"		groupadd $1	else		echo "	Preserving existing group $1"	fi}instuser(){	u=`grep "$1:" /etc/passwd`	if [ -z "$u" ]; then		instgroup $2		echo "	Creating user $1 of group $2"		if [ -f /sbin/nologin ]; then			useradd -d /unexisting -g $2 -s /sbin/nologin $1		else			useradd -d /unexisting -g $2 -s /bin/false $1		fi	else		echo "	Preserving existing user $1"	fi}

⌨️ 快捷键说明

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