Posts Tagged admin
Merge many depots
Posted by Lincoln Zuljewic Silva in HP-UX on August 25, 2009
When you have many depot files, you can create a single big depot and install it instead of install one by one. Let’s assume that you need install the following depots, and they are all located in the directory /tmp/install/depots:
autoconf-2.64-hppa-11.11.depot bison-2.4.1-hppa-11.11.depot gawk-3.1.7-hppa-11.11.depot sed-4.2.1-hppa-11.11.depot tcltk-8.5.7-hppa-11.11.depot texinfo-4.13-hppa-11.11.depot zip-3.0-hppa-11.11.depot
To create a single depot, run the follow commands:
# cd /tmp/install/ for i in `ls depots/*.depot` ;do swcopy -s /tmp/install/$i \* @/tmp/install/big;done
Now, to install it, you can use:
# swinstall -s /tmp/install/big
Solaris and NRPE
Posted by Lincoln Zuljewic Silva in Solaris on August 19, 2009
A very nice guide to install NRPE and nagios-plugins on Solaris 10 can be found here. To stop/start the NRPE, you can use the following command:
# svcadm disable svc:/network/nrpe/tcp
# svcadm enable svc:/network/nrpe/tcp
If you keep getting the "CHECK_NRPE: Error – Could not complete SSL handshake." message, see this FAQ comment
Resizing lvol in Red Hat AS 4
Posted by Lincoln Zuljewic Silva in Linux on August 18, 2009
As incredible as it seems, RHAS4 doesn't came with the resize2fs command (just like the others RH distributions). After some research, I found the tool that replace the resize2fs command and it's the ext2online, for example:
# ext2online /dev/mapper/VG00-vl02
Rotate log files in Linux
Posted by Lincoln Zuljewic Silva in Linux on May 15, 2009
An easy way (shell script) to rotate log files in Linux can be:
#!/bin/bash
# Include the following line in crontab:
#00 5 * * * /bin/rotate_logs.sh > /dev/null 2>&1
#
DATE=`date "+%Y%m%d"`
cd /var/log/
for i in messages secure cron lastlog
do
cp ${i} ${i}.${DATE}
> ${i}
gzip -9 ${i}.${DATE}
done
/etc/init.d/syslog restart
If you have any other log to rotate, you can change the line 8 and 10.
Recovering corrupted lvol on HP-UX
Posted by Lincoln Zuljewic Silva in HP-UX on May 14, 2009
Sometimes you can get the following error while try to access a directory in HP-UX:
# cd /DATA
sh: /DATA: The specified directory is not valid.
This error is caused because the file system is corrupted and you need run fsck on it.
First of all, umount the FS:
# umount /DATA
And them, run the fsck:
# fsck -y -o full /dev/vgLOG/lvol1on clear? (ynq)y
UX:vxfs fsck: WARNING: V-3-20836: file system had I/O error(s) on meta-data.
log replay in progress
pass0 - checking structural files
pass1 - checking inode sanity and blocks
fileset 999 primary-ilist inode 177502 marked bad, allocation flags (0x0001)
fileset 999 primary-ilist inode 177502 has invalid number of blocks (7309)
fileset 999 primary-ilist inode 177502 has invalid block map
fileset 999 primary-ilist inode 177502 failed validation clear? (ynq)y
fileset 999 primary-ilist inode 177859 marked bad, allocation flags (0x0001)
fileset 999 primary-ilist inode 177859 has invalid number of blocks (24850)
fileset 999 primary-ilist inode 177859 has invalid block map
fileset 999 primary-ilist inode 177859 failed validation clear? (ynq)y
fileset 999 primary-ilist inode 178243 marked bad, allocation flags (0x0001)
fileset 999 primary-ilist inode 178243 has invalid number of blocks (6417)
fileset 999 primary-ilist inode 178243 has invalid block map
fileset 999 primary-ilist inode 178243 failed validation clear? (ynq)y
fileset 999 primary-ilist inode 178793 marked bad, allocation flags (0x0001)
fileset 999 primary-ilist inode 178793 failed validation clear? (ynq)y
pass2 - checking directory linkage
pass3 - checking reference counts
pass4 - checking resource maps
fileset 999 au 2 imap incorrect - fix (ynq)y
fileset 999 au 2 iemap incorrect - fix (ynq)y
au 42 emap incorrect - fix? (ynq)y
au 42 summary incorrect - fix? (ynq)y
au 59 emap incorrect - fix? (ynq)y
au 59 summary incorrect - fix? (ynq)y
au 60 emap incorrect - fix? (ynq)y
au 60 summary incorrect - fix? (ynq)y
au 61 emap incorrect - fix? (ynq)y
au 61 summary incorrect - fix? (ynq)y
au 62 emap incorrect - fix? (ynq)y
au 62 summary incorrect - fix? (ynq)y
au 63 emap incorrect - fix? (ynq)y
au 63 summary incorrect - fix? (ynq)y
fileset 999 iau 2 summary incorrect - fix? (ynq)y
free block count incorrect 2153192 expected 2202289 fix? (ynq)y
free extent vector incorrect fix? (ynq)y
OK to clear log? (ynq)y
set state to CLEAN? (ynq)y
After that, you can mount the FS again.
# umount /DATA
Disable CTRL+C on Linux
Posted by Lincoln Zuljewic Silva in Linux on April 30, 2009
To disable CTRL+C on Linux, you can use the following command:
# stty intr undef
Using vi as crontab editor
Posted by Lincoln Zuljewic Silva in Linux on April 22, 2009
The default Debian installation use a non-vi editor when you try to use crontab (ie: “crontab -e”).
To change it to vi, you should do the following:
# rm -f /etc/alternatives/editor ln -s /usr/bin/vi /etc/alternatives/editor