Thursday, January 24, 2013

Random number

for i in {1..50}; do seq -83 -75|sort -R|head -n 1 ; sleep 0.5;done

Thursday, December 20, 2012

compress or optimize image

# jpegoptim --max=50 *.JPG; chmod 777 *

# find / -type f -name *.JPG -exec jpegoptim --max=50 {} \;

# find / -type f -name *.JPG -exec chmod 777 {} \;

Friday, December 7, 2012

Solaris 10 - Add swap file

To Add swap files:
1. mkdir -p /usr/local/swap
2. mkfile 20m /usr/local/swap/swapfile
3. swap -a /usr/local/swap/swapfile
4. echo "/usr/local/swap/swapfile - - swap - no -" >> /etc/vfstab
5. swap -s

Thursday, August 16, 2012

Solaris - Add routing table

route -p [add/delete] [hostname] [gateway] -ifp [interface]

p = permanent

Wednesday, August 15, 2012

convert flv to mp4

ffmpeg -i input.flv -vcodec copy -acodec copy output.mp4

Wednesday, May 30, 2012

Solaris - how to Resync mirror in raid 1

# metaoffline mirror submirror
# metaonline mirror submirror



From Oracle:
"During a reboot following a system failure, or when a submirror that was offline is brought back online, Solaris Volume Manager performs an optimized mirror resynchronization. The metadisk driver tracks submirror regions. This functionality enables the metadisk driver to know which submirror regions might be out-of-sync after a failure. An optimized mirror resynchronization is performed only on the out-of-sync regions. You can specify the order in which mirrors are resynchronized during reboot. You can omit a mirror resynchronization by setting submirror pass numbers to zero"

Solaris file clean up


1. Crash dump file --> /var/crash/dumpfile
2. Explorer file   --> /opt/SUNWexplo/output/*.tar.gz
3. Sar output file --> /var/adm/sa/sar*
4. Patch undo file --> find /var -name undo.Z

(reference : http://www.runningunix.com/2009/02/cleaning-out-var-in-solaris/ )

It is recommended to move those file to other directory instead of remove it.

Solaris - GUI and CLI mode using dtlogin

Stopping dtlogin
# /etc/init.d/dtlogin stop

Starting dtlogin
# /etc/init.d/dtlogin start

To enable dtlogin type command:
# /usr/dt/bin/dtconfig -e

To disable dtlogin
# /usr/dt/bin/dtconfig -d

To kill dtlogin type command:
# /usr/dt/bin/dtconfig -kill

Read man page of dtlogin for more information.

Monday, May 28, 2012

How to update Sun V240 firmware

1. Download Sun V240 firmware from Sun System Handbook
2. Run explorer and collect output if possible
3. Screen shot current firmware (prtdiag -v)
4. Make sure OBP --> auto-boot=true and boot-device=disk0
5. Run step below at OS level
    # unzip 121683-06.zip
    # cd 121683-06
    # ./unix.flash-update.SunFire240.sh

Sunday, May 27, 2012

How to enable CGI script in Apache

Step 1:
vi /etc/apache2/httpd.conf
add this line
    "AddHandler cgi-script .cgi .pl"
save & exit


Step 2:
vi /etc/apache2/sites-enabled/000-default
add "+ExecCGI" under Options line

        Options Indexes FollowSymLinks MultiViews +ExecCGI
        AllowOverride None
        Order allow,deny
        allow from all



Step 3:
service apache2 restart

Sunday, November 27, 2011

Compression using 7z

ultra = 7z a -t7z /home/file.7z /home/file -mx9
max = 7z a -t7z /home/file.7z /home/file -mx7
normal = 7z a -t7z /home/file.7z /home/file -mx5
fast = 7z a -t7z /home/file.7z /home/file -mx3
fastest = 7z a -t7z /home/file.7z /home/file -mx1
no = 7z a -t7z /home/file.7z /home/file -mx0

to extract
7z x file.7z

Wednesday, October 19, 2011

display or view dns cache entries

#rndc dumpdb -all
#more /etc/namedb/named_dump.db

Tuesday, October 11, 2011

Dynamic ip with permanent DNS

BSD:

vi /etc/dhclient.conf
add
supersede domain-name-servers x.x.x.x , y.y.y.y ;

x.x.x.x = dns-server-1
y.y.y.y = dns-server-2

--------------------------------------------------------
Ubuntu :

root@mail:~# more /etc/dhcp3/dhclient.conf
request subnet-mask, broadcast-address, time-offset, routers, host-name, ntp-servers;
supersede domain-name "ubuntu8.com";
prepend domain-name-servers 8.8.8.8;

enable ssh in backtrack

#sshd-generate
#/etc/init.d/ssh start
#netstat -an | grep 22

Monday, January 10, 2011

steps to perform the CPU MMU upgrade

old setting

XSCF> showboards -a

XSB DID(LSB) Assignment Pwr Conn Conf Test Fault

---- -------- ----------- ---- ---- ---- ------- --------

00-0 00(00) Assigned y y y Passed Normal Domain 0

00-1 01(00) Assigned y y y Passed Normal Domain 1

00-2 01(01) Assigned y y y Passed Normal Domain 1

00-3 03(03) Assigned y y y Passed Normal Domain 3

01-0 02(00) Assigned y y y Passed Normal Domain 2

01-1 03(00) Assigned y y y Passed Normal Domain 3

01-2 03(01) Assigned y y y Passed Normal Domain 3

01-3 00(01) Assigned y y y Passed Normal Domain 0



new setting

XSCF> showboards -a

XSB DID(LSB) Assignment Pwr Conn Conf Test Fault

---- -------- ----------- ---- ---- ---- ------- --------

00-0 00(00) Assigned y y y Passed Normal Domain 0

00-1 01(00) Assigned y y y Passed Normal Domain 1

00-2 01(01) Assigned y y y Passed Normal Domain 1

00-3 03(02) Assigned y y y Passed Normal Domain 3

01-0 02(00) Assigned y y y Passed Normal Domain 2

01-1 03(00) Assigned y y y Passed Normal Domain 3

01-2 03(01) Assigned y y y Passed Normal Domain 3

01-3 03(03) Assigned y y y Passed Normal Domain 3



XSCF> showdevices -d 0

XSCF> showdevices -d 3



XSCF> showdcl -d 0

DID LSB XSB Status

00 Running

00 00-0

01 01-3



XSCF> showdcl -d 3

DID LSB XSB Status

03 Running

00 01-1

01 01-2

02 00-3



XSCF> setdcl -d 3 -a 3=01-03



XSCF> showdcl -d 3

DID LSB XSB Status

03 Running

00 01-1

01 01-2

02 00-3

03 01-3



XSCF> moveboard -d 3 -c assign 01-03

XSB#01-3 will be assigned to DomainID 0 immediately. Continue?[y|n] :y

Start unconfiguring XSB from domain.

Unconfigured XSB from domain.

XSB power off sequence started. [1200sec]

0..end

Operation has completed.



XSCF> showboards -d 3

XSB DID(LSB) Assignment Pwr Conn Conf Test Fault

---- -------- ----------- ---- ---- ---- ------- --------

00-0 00(00) Assigned y y y Passed Normal

01-3 00(01) Assigned y n n Passed Normal





XSCF> addboard -c configure -d 3 01-03

XSB#01-3 will be configured into DomainID 0. Continue?[y|n] :y

Initial diagnosis started. [1800sec]

0..... 30..... 60..... 90....end

Initial diagnosis has completed.

Start configuring XSB to domain.

Configured XSB to domain.



XSCF> showboards -d 3

XSCF> showdevices -d 3



setdcl –d 0 –r 01

XSCF> showdcl -d 0

XSCF> showboards –d 0

Thursday, January 6, 2011

Linux - change brightness

reference : http://www.thinkwiki.org/wiki/LCD_Brightness

This worked for my X61:
Once your brightness keys work, you can set the brightness by writing to the procfs:

# echo 100 > /proc/acpi/video/VID/LCD0/brightness

using a script and acpid events.

Wednesday, January 5, 2011

Linux - Burn CD using command cdrecord

cdrecord -v -dao -eject speed=8 dev=1,0,0 file.iso

Wednesday, December 22, 2010

Answer me first before log a call

While waiting for the explorer data. I would like to understand:
1) When you first discover the amber light is on?
2) Is there any software installation/maintenance been performed recently?
3) Is there any hardware installation/maintenance been performed recently?
4) Is there any recent power failure?
5) What action you have tried to troubleshoot?
6) Do you notice any other abnormal situation (e.g. daemon down, network not working, etc)? Or the server still running as usual?

Thank you.

Sunday, December 19, 2010

Linux - Enable root passwd

from : http://www.ubuntugeek.com/enable-and-disable-ubuntu-root-password.html


If you want to enable root account (which is not recommended) enter the following command.

$sudo passwd root

This will prompt for a new root password and once you confirm it, you can start using the root account to login.

If you want to disable root account in ubuntu you need to lock the root account by using the following command

$sudo passwd -l root

If you want to work on a root console you’d better use the following command

$sudo -i

Friday, December 17, 2010

Picasa login failed - Network

http://www.google.com/support/forum/p/Picasa/thread?tid=6eb9c7d06d5aa10c&hl=en