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.