Posts tagged Debian

HP Array Configuration Utility RAID Controller Checker Script

2

hpacucli-check.sh is a bash shell script that checks the status of the logical drives on a HP Server with hpacu (HP Array Configuration Utility Client) installed, syslogging and sending an email with errors to administrators.

Tested ona HP Proliant DL580 G5 Server with Debian Lenny and HP Array Configuration Utility Installed, this software is available from the “HP ProLiant Support Pack CD for Debian GNU/Linux 5.0 (“lenny”) and Ubuntu 9.04 (“jaunty”) x86 and AMD64/EM64T” downloadable from the HP Support Web Site.

http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=US&swItem=MTX-799829d8271f455d9367978b5a&prodTypeId=15351&prodSeriesId=1121516

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
 
###
# FILE: hpacucli-check.sh (2010-11-05)
# LICENCIA: GNU/GPL v3.0
# USAGE: Check the status of the logical drives on a HP Server 
#        with hpacu (HP Array Configuration Utility Client)
#        installed, syslog and send an email with errors.
# AUTHOR: Olaf Reitmaier Veracierta <olafrv@gmail.com> / www.olafrv.com
##
 
MAIL=root@localhost
HPACUCLI=`which hpacucli`
HPACUCLI_TMP=/tmp/hpacucli.log
 
hpacucli ctrl all show | grep "Slot " | while read line1
do
   slot=`expr match "$line1" '.*Slot \([0-9]\).*'`
   echo "Searching controller in slot #$slot..."
   hpacucli ctrl slot=$slot array all show | grep array | while read line2
   do
      array=`expr match "$line2" '.*array \([a-Z]\).*'`
      echo "Searching array $array..."
      hpacucli ctrl slot=$slot array $array logicaldrive all show | grep logicaldrive | while read line3
      do
         logicaldrive=`expr match "$line3" '.*logicaldrive \([0-9]\).*'`
         echo "Searching logical drive #$logicaldrive..."
         if [ `hpacucli ctrl slot=$slot array $array logicaldrive $logicaldrive show | grep "Status: OK$" | wc -l` -lt 2 ]
         then
            msg="RAID Controller Error Slot #$slot Array $array Logical Drive #$logicaldrive"
            echo $msg
            logger -p syslog.error -t RAID "$msg"
            $HPACUCLI ctrl slot=$slot show config detail > $HPACUCLI_TMP
            mail -s "$HOSTNAME [ERROR] - $msg" "$MAIL" < $HPACUCLI_TMP
            rm -f $HPACUCLI_TMP
         fi
      done
   done
done

See Also: http://wiki.debian.org/HP/ProLiant

Debian GRUB 1 and 2 with password (UPDATED)

0

In Debian Lenny (Stable) the GRUB 2 version is 1.96 and is still without password support.

If you install a more recent version from Debian Squeeze (Testing) such as 1.97, which comes with password support.

*** This script is intented GRUB version > 1.96, but please test it before use on production systems ***

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 
###
# FILE: grubpw2.sh (June 1th, 2011)
# USAGE: Set GRUB 1 and 2 superuser (root) password,
#        must be run manually after each kernel upgrade.
# AUTHOR: Olaf Reitmaier Veracierta <olafrv@gmail.com>
# REFERENCE: http://www.gnu.org/software/grub/manual/
# LICENSE: GNU/GPL v3 or superior
##
 
###########################
# CHANGE THIS AS YOU NEED #
###########################
 
# GRUB 1 (0.X) password (Generated with grub-md5-crypt)
 
# Escape this string or bash mess it up!!!
grubpw="\$1\$whX1i\/\$J7lwipZAl3BkaM9b\/DlEB\."
grubcf=/boot/grub/menu.lst
 
# GRUB 2 (1.X) password
 
GRUBPW="t0r0nd0y++"
GRUBCF=/boot/grub/grub.cfg
 
################################################################
# Do not edit any line bellow unless you what you're doing !!! #
################################################################
 
if [ ! -z "$1" ] && [ "$1" != "disable" ]
then
	echo "Usage ./grubpw.sh [disable]" 1>&2
	exit 1
fi
 
g1ok=`grub-setup --version | grep "0." | wc -l`
 
if [ $g1ok -eq 0 ] 
then
	echo "GRUB version 1" 1>&2
 
	if [ "$1" == "disable" ]
	then
		sed -i /"^#\s*password.*$"/d $grubcf
      sed -i /"^\s*password.*$"/d $grubcf
	else
  	   sed -i /"^#\s*password.*$"/d $grubcf
      sed -i /"^\s*password.*$"/d $grubcf
 	   sed -i "1i\password --md5 $grubpw" $grubcf
	fi
else
 
	g2ver=`grub-setup --version | grep "1." | cut -d"." -f2 | cut -d"+" -f1`
 
	if [ $g2ver -gt 96 ]
	then
		echo "GRUB version 2" 1>&2
 
		if [ "$1" == "disable" ]
		then
			rm /etc/grub.d/01_password
		else
			cat > /etc/grub.d/01_password << DATA
cat << EOF
# This is the superuser for grub editing!!
set superusers="root"
password root $GRUBPW
EOF
DATA
			chmod 750 /etc/grub.d/01_password
 
		fi
 
		update-grub
		chown root:root $GRUBCF
		chmod 600 $GRUBCF
 
		if [ "$1" == "disable" ]
		then
			sed -i -e '/^menuentry /s/ --users .* {/ {/' $GRUBCF
		else
			sed -i -e '/^menuentry /s/ {/ --users root {/' $GRUBCF
		fi
 
	fi
fi

Modify CONTROL file in Debian Package

0

Suppose you have your-package.deb file and want to change files inside the package:

1
2
3
mkdir -p tmp/DEBIAN
dpkg-deb -x your-package.deb tmp/
dpkg-deb --control your-package.deb tmp/DEBIAN

Modify the file tmp/DEBIAN/control as you like it.

1
dpkg-deb -b tmp your-package-custom.deb

Finally,

1
dpkg -i your-package-custom.deb

Done!!!

Go to Top
?>