Category Archives: Bash - Page 2

Execute script on boot

don’t forget to set the correct permissions on your script, i like 4755 for these types of scripts

Unsign, resign and update .JAR manfests

A .jar file is simply a .zip with a funky extension. Rename the .jar to .zip and unzip the file.

CD into the META-INF dir and delete everything EXCEPT the manifest file.

Edit the Manifest file and remove all the SHA hashes (probably not necessary)

Once this has been done, rezip the file

Now we need to sign the jar. (Make sure you have the latest JDK installed)

To do this we create a key:

Follow the bouncing ball filling in all the details.

Then sign your JAR file with the following:

That is it!

too many files in directory to delete?

find . -name ‘*.net*’ | xargs rm

change *.net to whatever is necessary.

this will iterate through each file name and apply RM to it.

rm -f * will not work where there are too many files as it simply appends each file name to form a massive string.

xfs Maintenance

http://st-on-it.blogspot.com.au/2008/02/how-to-defragment-your-xfs-partition.html

http://serverfault.com/questions/406069/why-are-my-xfs-filesystems-suddenly-consuming-more-space-and-full-of-sparse-file

nmap port scanning

nmap -p80 10.1.1.0/24 -oG – | grep 80/open

Will display all ports in the /24 that have port 80 open

Rackable IPMI reset

Rackable half size servers pack unbelievable punch per $$$. However finding resources for these servers is almost impossible.

We came across a number of these and had a very hard time cracking the IPMI. Below are the steps to reset the password of the IPMI so you can gain access via the web console.

1. Power on the server and go into the bios and setup the BMC/IPMI LAN config.
2. Plug a cat 5 cable into IPMI port.
3. Load whatever flavour of linux you like onto the server.
4. log into the server and make sure the ipmi drivers are loaded, if there aren’t then ->

modprobe ipmi_msghandler
modprobe ipmi_devintf
modprobe ipmi_si

run lsmod, and make sure the modules have loaded.

then simply run

ipmitool -I open lan set 1 password NEWPASSWORD
ipmitool -I open user set password 2 NEWPASSWORD

this should reset both of the passwords for the root user to NEWPASSWORD

open a web browser and point it to the IPMI IP address you setup in Step 1.

Log in with your new credentials!!!

Resources:
http://serverfault.com/questions/85042/is-it-possible-to-reset-the-password-on-a-supermicro-ipmi-interface
http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/linux/bks/SGI_Admin/books/Guide_AdminXE_AG/sgi_html/ch01.html#Z1165360258tls

Xenserver LVM over iSCSI

Trying to reclaim space from that VM you deleted several months ago?

This is a known issue with Xenserver and iSCSI when snapshots are used.

The short answer is that if you allow your SR to fill up too much, the automatic coalesce leaf operations performed by XS will not be able to be performed as a certain amount of space is required for this function to reclaim space.

The basic rule is that there must be Double the VM size of free space on the SR available for the coalesce function to work.

So if you delete a 100GB VM, you MUST have at least 200GB of free available space on the SR.

minimal centos

Remove those ugly useless packages from your CentOS 6 Server!

http://kyotera.net/2012/02/extra-packages-in-minimal-installation-of-centos-6-2/

Using parted to create partitions

http://blog.derakkilgo.com/2010/06/12/warning-the-resulting-partition-is-not-properly-aligned-for-best-performance/

Start all VMs on HOST boot

place the following in /etc/rc.local

sleep 30
xe vm-start tags=autostart –multiple

mark all VMs with autostart tag and they’ll be started!