Friday, February 07, 2014

remove a line from a file

sed -i '22d' /root/.ssh/known_hosts


or better is to do ssh-keygen  -R hostname/IP

linux change root disk grub-install

redetect disks by grub-install in case dd ing 446 bytes from one disk to the other did not work, /boot/grub/devices.map needs to be fixed

Wednesday, February 05, 2014

perl command line arguments

#!/usr/bin/perl -w

use strict;
use Getopt::Long;
use utils qw( &usage );
my($host,$port,$user,$password,$file,$opt_w,$opt_c) = ("",22,"","","","","","","","");

Getopt::Long::Configure('bundling', 'no_ignore_case');
GetOptions
("H|host=s"     => \$host,
 "p|port=s"     => \$port,
 "U|user=s"     => \$user,
 "P|password=s" => \$password,
 "F|file=s"     => \$file,
 "w|warning=s"  => \$opt_w,
 "c|critical=s" => \$opt_c,
 );


($host) ||  usage("Host not specified\n");
($user) ||  usage("SFTP Username not specified\n");
($password) || usage("SFTP password not specified\n");
($file) ||  usage("File to upload and download not specified\n");
($opt_w) || usage("Warning threshold not specified\n");
($opt_c) || usage("Critical threshold not specified\n");

Tuesday, February 04, 2014

rvm install ruby specific version

\curl -k -sSL https://get.rvm.io | bash -s stable --ruby=1.9.3-p362

Monday, February 03, 2014

replace root with lvm

In rescue mode::

KER=`ls /lib/modules` #if single kernel
initrd -v -f /boot/initrd-$KER.img $KER

DAAA  :::: make sure you do not have rd_NO_LVM in the options passed to vmlinuz