Friday, February 12, 2010

[Level 2] Install firefox plugin "flash player" on OpenSolaris

When I use OpenSolaris b130.
I download the flash player from adobe website,
and put the library file to the "plugins" folder of firefox,
but firefox still cannot display flash content well.

So how can we install flash player on OpenSolaris?

You can install it from extra repository.
extra repository=> https://pkg.sun.com/opensolaris/extra/
pkg name=> firefox/plugin/flashplayer

After install it, then you can see it works.

Wish this helps.

regards,
Stanley Huang

Sunday, February 7, 2010

[Level 3] Setting Local Repository.

Days ago, I am the speaker of Sun campus seminar, 
my subject of the session is the OpenSolaris new feature.
Because I have to demo how to install package by package manager,
and I'm afraid that the school cannot provide my laptop to surve the net.
I decided to setup the local repository on my laptop.

The following script is the local repository setup script,
please refer to it.

regards,

Stanley Huang

#!/usr/bin/bash
clear
set -f ## noglob

fRepoISO=/Karajon/ISOs/osol-repo-0906-full.iso
dMP=/mnt/repo && pfexec mkdir -p $dMP
fsRepo=rpool/repo && pfexec zfs create -o compression=on $fsRepo 2>/dev/null
dRepo=`zfs get -H mountpoint $fsRepo | awk '{print($3)}'`
sHost=192.168.1.100
sHostname=stanley-nb
nPort=81
sIF=yge0:1
fBackupPublisher=/PkgPublisher.bak

cat <
Repository Full ISO Image    : $fRepoISO
Iso Image Mount Point        : $dMP
Repository ZFS File System   : $fsRepo
Repository ZFS Directory     : $dRepo
Repository Host              : $sHost
Repository Hostname          : $sHostname
Repository Server Port       : $nPort
Repository Binding Interface : $sIF
Backup Publisher File        : $fBackupPublisher
EOF

read -p "Are all setting correct (yes/NO)? " yN
[ "$yN" != "yes" ] && [ "$yN" != "YES" ] && exit 0

addHosts() {
  grep "^$sHost[     ]" /etc/hosts | grep $sHostname >/dev/null || echo "$sHost    $sHostname" >> /etc/hosts
}

rsyncRepo() {
  pfexec mount -F hsfs `pfexec lofiadm -a $fRepoISO` $dMP
  pfexec rsync -aP $dMP $dRepo
}

setPkgServerProp() {
  pfexec svccfg -s application/pkg/server setprop pkg/inst_root=$dRepo/repo
  pfexec svccfg -s application/pkg/server setprop pkg/readonly=true
  pfexec svccfg -s application/pkg/server setprop pkg/port=$nPort
}

modifyPkgServerCfg() {
  pfexec perl -pi -e "s|^origins.*|origins = http://$sHost:$nPort|" $dRepo/repo/cfg_cache
}

bindingIF() {
  ifconfig $sIF plumb set $sHost up
}

randrServer() {
  pfexec svcadm refresh application/pkg/server
  pfexec svcadm restart application/pkg/server
}

backupPublisher() {
  if [ -f /$fBackupPublisher ]
  then
    read -p "Backup file exists($fBackupPublisher), Do you want to overwrite it (Y/n)?" Yn
    if [ "$Yn" == "N" ] || [ "$Yn" == "n" ]
    then
      exit
    fi
  fi
  pfexec pkg publisher > /$fBackupPublisher
}

modifyPublisherName() {
  pfexec pkg set-publisher -O http://$sHost:$nPort opensolaris.org
}

showPkgCmds() {
  cat <
To change repository, please use following commands:
# pfexec pkg set-publisher -m http://$sHost:$nPort local-repository
# pkg publisher
# pfexec pkg set-publisher -M http://$sHost:$nPort local-repository
# pfexec pkg set-publisher -O http://$sHost:$nPort local-repository
EOF
}

############################################# main

addHosts
#rsyncRepo
setPkgServerProp
modifyPkgServerCfg
bindingIF
randrServer
backupPublisher
modifyPublisherName
showPkgCmds




Wish this helps.

regards,
Stanley Huang

Monday, February 1, 2010

[Level 2] MySQL Schedule Event

If you want to use MySQL scheduling,
you can create event for this purpose.
 
ex. 
CREATE EVENT e
 ON SCHEDULE EVERY 1 MONTH
   STARTS TIMESTAMP '2010-01-01 00:00:00'
   ENDS TIMESTAMP '2010-12-31 23:59:59'
 DO DELETE FROM 'xxxxx';  



Wish this helps.

regards,
Stanley Huang