[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cpint devices



 ...
> See attached.   It is also at
>
> 	ftp://ftp.bmc.com/pub/linux/cpint/cpint.init

Ooopppsss...   Forgot to attach it.

-- RMT

#!/bin/sh 
# 
# 
#		an INIT script for the CPINT service 
#	  Date: 2002-Apr-18 (Thu) 
#		2003-Feb-28 (Fri) 
# 
# 
 
module="cpint" 
device="cpint" 
group="wheel" 
mode="660" 
 
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH 
export PATH 
 
Z=`basename $0` 
 
case "$1" in 

	start) 

		shift 

		# invoke insmod with all arguments we got
#		/sbin/insmod -f $module $* || exit 1
		/sbin/insmod $module $* || exit 1

		major=`cat /proc/devices \
			| awk "\\$2==\"$module\" {print \\$1}"`

		# Remove stale inodes and replace them, 
		# then give gid and perms
		# Usually the script is shorter, 
		# it's cpcmd that has several devices in it.

		#rm -f /dev/${device}*
		rm -f /dev/${device}0 /dev/${device}8 /dev/${device}220 
		mknod /dev/${device}0 c $major 0
		mknod /dev/${device}8 c $major 8
		mknod /dev/${device}220 c $major 220
		chgrp $group /dev/${device}*
		chmod $mode  /dev/${device}*
		ln -sf ${device}8 /dev/cpcmd
		ln -sf ${device}220 /dev/cpmon

		;; 
 
	stop) 
 
		shift 

		# Remove device inodes first 
		rm -f /dev/${device}0 /dev/${device}8 /dev/${device}220 \
					/dev/cpcmd /dev/cpmon
 
		# invoke rmmod with all arguments we got
		/sbin/rmmod $module $* || exit 1
 
		# miscellaneous clean-up 
		rm -f /var/run/cpint.pid 
		rm -f /var/lock/cpint 
 
		;; 
 
	restart|reload|force-reload) 
		$0 stop 1>/dev/null 2>/dev/null 
		exec $0 start 
		;; 
 
	stat*) 
		# check that the module is loaded 
		lsmod | awk '{print $1, $3}' \
			| grep "^$module " > /tmp/$module-$$ 
		if [ "$?" != 0 ] ; then 
			echo "$Z: HCP command interface is down" 
			rm -f /tmp/$module-$$ ; exit 3 ; fi 
		awk '{print "MODULE=" $1}' < /tmp/$module-$$ 
		rm /tmp/$module-$$ 
		# check that the module is working 
		cat /proc/devices | awk '{print $2, $1}' \
			| grep "^$module " > /tmp/$module-$$ 
		if [ "$?" != 0 ] ; then 
			echo "$Z: HCP command interface is down" 
			rm -f /tmp/$module-$$ ; exit 3 ; fi 
		awk '{print "DEVICE_MAJOR=" $2}' < /tmp/$module-$$ 
		rm /tmp/$module-$$ 
		echo "$Z: HCP command interface is available" 
		exit 0 
 
		;; 
 
	start_msg) 
		echo "Starting HCP command interface" 
		;; 
 
	stop_msg) 
		echo "Stopping HCP command interface" 
		;; 
 
	*) 
		echo "Usage: $Z [start | stop]" 
		exit 2 # invalid or excess arguments 
		;; 
 
	esac 
 
### BEGIN INIT INFO 
# Provides: cpint 
# Required-Start: 
# Required-Stop: 
# Default-Start: 
# Default-Stop: 
# Short-Description: HCP command interface 
# Description: HCP command interface 
### END INIT INFO 
 


Reply to: