Klaus' Blog

going public

  • Categories

  • Archives

Admin Helper

Posted by klauskurz on 24. February 2010

Unknown Publisher

set environment variable:
SEE_MASK_NOZONECHECKS=1

Mount

mount -t cifs  -o user=username,password=secret      \\\\servername\\sharename /mnt/here-is-the-mountpoint
mount -t iso9660 -o loop,ro /image.iso /mnt/rom

SVN propset

svn propset svn:keywords "LastChangedDate Date LastChangedRevision Revision Rev LastChangedBy Author HeadURL URL Id" *.php

python ignore DeprecationWarning

python -Wignore::DeprecationWarning

Oracle Shutdown

sqlplus sys/<pw> as sysdba
shutdown immediate
shutdown abort
startup mount
alter database open;

Delete Archive Logs

rman TARGET /
DELETE ARCHIVELOG ALL;
crosscheck archivelog all; #marks the controlfile that the archives have been deleted
delete expired archivelog all; #deletes the log entries identified above.

Oracle Links

Initialisation Parameters: http://www.databasejournal.com/features/oracle/article.php/3485216
Commandline info: http://www.ss64.com/
Oracle Info: http://www.psoug.org/library.html
System Tables: http://www.techonthenet.com/oracle/sys_tables/index.php
Timestamps / Zeitzonen: "http://itblog.eckenfels.net/archives/13-Zeitstempel-in-Datenbanken-Oracle.html"
Oracle Base: http://www.oracle-base.com
Oracle Examples: http://www.samoratech.com/
Regex Oracle 10g: http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/rischert_regexp_pt1.html
Regular Expression (regex) in 10g: http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/rischert_regexp_pt1.html
Backup: http://www.oracle.com/technology/obe/2day_dba/backup/backup.htm
Backup: http://www.oracle.com/technology/deploy/availability/index.html

SSH autologin

# to generate keys:
mkdir -p .ssh
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
# to import keys:
cat ~/.ssh/id_rsa.pub | ssh root@hostname 'mkdir .ssh; cd .ssh; cat >> authorized_keys; chmod 600 authorized_keys'
cat ~/.ssh/id_rsa.pub | ssh root@hostname 'cd .ssh; cat >> authorized_keys; chmod 600 authorized_keys'

find in jar

find . -iname "*.jar" -exec unzip -l {} \; | grep -H "class"

 

#!/bin/sh
LOOK_FOR="codehaus/xfire/spring"
for i in find . -name "*jar" do
  echo "Looking in $i ..."
  jar tvf $i | grep $LOOK_FOR > /dev/null if [ $? == 0 ] then
    echo "==> Found \"$LOOK_FOR\" in $i"
  fi
done

tar

# Create tar archive
tar cvf foo.tar foo
tar czvf foo.tar.gz foo
# Extract files from archive
tar xvf foo.tar
tar xvzf foo.tar.gz
tar xvjf foo.tar.bz2

find

find . -xdev -maxdepth 1  -type d   | xargs du -sm | sort -g
whereis
which
file
type
find / -xdev -type f -size +20000k -print0 | xargs -0  ls -l

Linux Raid Info (mdadm)

#!/bin/bash
for raid in $(cat /proc/mdstat | grep "^md" | sed "s/:.*//g") do
        mdadm --misc   --detail /dev/$raid
        for raid_device in $(mdadm --misc   --detail /dev/$raid  2>/dev/null   | grep "/dev/s" | sed "s/[^/]*//")
        do
                mdadm --examine $raid_device 2>/dev/null
                udevadm info --query=all --name=$raid_device |  egrep "ID_SERIAL=|DEVPATH|DEVLINKS"
        done
done

SED

sed  "s/\(^[^@]*\)[@][^@]*/\1@domain1.com \1@domain2.com/g"

Copy Root

#!/bin/sh

exclude_list="
--exclude=./lost+found/*
--exclude=./tmp/*
--exclude=./var/tmp/*
--exclude=./var/run/*
--exclude=./rootbackup/*
--exclude=./oracle/backup/*
"
filename=/rootbackup/rootbackup.tar.gz

                echo "doing backup..."

                tar -czf ${filename}  \
                        --one-file-system \
                        --preserve-permissions \
                        --atime-preserve \
                        --preserve-order \
                        --numeric-owner \
                        --sparse \
                        --ignore-failed-read \
                        ${exclude_list}  .

Bash Primer

http://www.oracle.com/technology/pub/articles/calish_file_commands.html
http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part1.html
http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part2.html

DOS Batch Primer

http://weblogs.asp.net/jgalloway/archive/2006/11/20/top-10-dos-batch-tips-yes-dos-batch.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: