作者归档文章

开通新浪微博 @FreeLAMP

由于没有很多的时间写作,只是会把自己看到的,想到的,直接转到微博上,加几句自己的评论。

欢迎上新浪微博粉我: @FreeLAMP

 

Soalris 上安静模式安装 SMI Agent

cd /var/tmp/Solaris

sh ./install.bin -f ../SilentInstallation.properties
Preparing to install…
Extracting the JRE from the installer archive…
Unpacking the JRE…
Extracting the installation resources from the installer archive…
Configuring the installer for this system’s environment…

Launching installer…

Preparing SILENT Mode Installation…

===============================================================================
Brocade SMI Agent                 (created with InstallAnywhere by Macrovision)
——————————————————————————-

===============================================================================
Installing…
————-

[==================|==================|==================|==================]
[------------------|------------------|------------------|------------------]

Installation Complete.

 

 

SilentInstallation.properties 文件内容:赋值部分:

INSTALLER_UI = silent
USER_INSTALL_DIR = /opt/SMI
INSTALLER_LOG_FILE = /var/tmp/installsmi.log
CIMOM_HTTP_PORT = 5988
CIMOM_HTTPS_PORT = 5989
CLIENT_AUTH_DISABLED = 1
IND_AUTH_DISABLED = 1
SECURITY_DISABLED = 1
WINDOWS_DOMAIN_AUTH_DISABLED = 1
CONSOLE_LOGGING_DISABLED = 1
FILE_LOGGING_ENABLED = 1
LOG_FILE_NAME = /var/adm/smi.log
LOG_FILE_COUNT = 5
LOG_FILE_SIZE = 10240
SERVICE_ENABLED = 1

MySQL 多数据库的备份

本文介绍了用 –defaults-group-suffix 参数,传递写在指定配置文件中的所有的数据库配置到 mysqldump 命令来同时备份多个库的实现办法。

$ mysqldump  –defaults-group-suffix=_usera –defaults-file=./.my.cnf  usera_a > user_a.sql

./.my.cnf  的格式如下:

[client]
port=3306
password=mypassword
# 脚本中要求 DB 名须和 user 名一致

[client_usera]

# 等号前后有空格隔开

host = hosta
user = usera

[client_userb]
host = hostb
user = userb

具体脚本如下:

(more…)

Sparc 平台上检测机器型号和序列号

uname -a 不能正确显示型号,

# uname -a
SunOS xxxx 5.10 Generic_142900-15 sun4u sparc SUNW,SPARC-Enterprise

可以用 prtconf 命令检查  banner-name 来知道具体的型号。

# prtconf -bv
name:  SUNW,SPARC-Enterprise
model:  FF1
banner-name:  SPARC Enterprise M4000 Server
idprom:  01850021.286e5d5e.00000000.6e5d5e8d.00000000.00000000.00000000.00000000
openprom model:  SUNW,4.24.15
openprom version: ‘OBP 4.24.15 2010/09/29 10:16′

 

另外可以用 prtpicl 命令来检查机器序列号,而不需要通过 console 去检查,或者用执行时间比较长的: prtdiag -v

# prtpicl -vc chassis

:MfgName       Sun Microsystems, Inc

:SerialNumber  0839SSS888 <Faked one  for privacy>

:D escription   SUNW,Sun Fire T2000 Chassis

在  Non-Sun 的 Sparc 平台上, 可以用:

prtpicl -v -c jupiter 来检查

 

Solaris x86 平台则可以用 smbios -t1 来查看序列号。

 

Sparc 上编译 filebench 1.4.8

filebench 是一个做磁盘,文件系统性能测试的工具,目前是 OpenSolaris 的一部分,最新的版本不提供安装包, 必须自己编译。

以下是简单的几个步骤: (more…)

解决 Mambo 升级到 4.65 的问题以及 WordPress 不能升级的问题

Mambo 升级到  4.65 后,系统报告

Warning: Invalid argument supplied for foreach() in .../includes/cmtclasses.php on line 713
Warning: Invalid argument supplied for foreach() in ...l/includes/cmtclasses.php on line 653

Google 后发现 http://forum.mambo-foundation.org/showthread.php?t=7205 需要添加一个列到  mos_modules 表中。

mysql> alter table mos_modules  add column groups text not null;

WordPress 是不能自动升级,提示 "您没有足够的权限访问这个页面", Google 后发现 修改 wp_options 中的 一个  wp_user_roles 的 option_value: 

update wp_options set option_value='a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:64:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:24:"NextGEN Gallery overview";b:1;s:19:"NextGEN Use TinyMCE";b:1;s:21:"NextGEN Upload images";b:1;s:22:"NextGEN Manage gallery";b:1;s:19:"NextGEN Manage tags";b:1;s:29:"NextGEN Manage others gallery";b:1;s:18:"NextGEN Edit album";b:1;s:20:"NextGEN Change style";b:1;s:22:"NextGEN Change options";b:1;s:17:"manage_newsletter";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:64:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:24:"NextGEN Gallery overview";b:1;s:19:"NextGEN Use TinyMCE";b:1;s:21:"NextGEN Upload images";b:1;s:22:"NextGEN Manage gallery";b:1;s:19:"NextGEN Manage tags";b:1;s:29:"NextGEN Manage others gallery";b:1;s:18:"NextGEN Edit album";b:1;s:20:"NextGEN Change style";b:1;s:22:"NextGEN Change options";b:1;s:17:"manage_newsletter";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}'
where option_name="wp_user_roles";

Compact VDI Image file

Compacted my Windows XP 6GB VDI Image to 4GB  today according to this article.

Steps:

  1. Defragment Guest
  2. Defragment Guest Again
  3. copy nullfile to guest, and run nullfile on guest
  4. shutdown guest
  5. On Host, Run: VBoxManage modifyvdi XP.vdi compact

解决 Discuz! 的 .htaccess 问题

Discuz! 移植到 GoDaddy 后,发现原来的 URL 优化在新的服务器上都是 404 错误了。  Google 搜索都说 通过 添加

# Options -Multiviews 或者  # Options +FollowSymLinks 来解决的,在我的环境下,证明这些打开都没有用而是去掉第一个 domain 的信息。

RewriteEngine On
RewriteBase /
RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$4&page=$2
RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
RewriteRule ^tag-(.+)\.html$ tag.php?name=$1
~
~

问题随即解决。

原来的控制文件如下:

RewriteEngine On
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2

Convert back WP MU to WordPress

Godaddy’s WordPress only support single user, not the MU version, have to convert back original WPMU version to single user version.

Since I have to install multiple version of WordPress, each of them has its own DB. I put a .sid for each of mysql DBs as original .my.cnf file.

Contents like this:

# freelamp.com
[client]
host = frexxxxxxx.db.7114699.hostedresource.com
user = frexxxxx
port=3306

[mysql]
database = frexxxxxxxx

Then create alias in .bash_profile for each mysql instance:

alias mysql.albertxu=’mysql  –defaults-file=~/.albertxu -p ‘
alias mysql.freelamp=’mysql  –defaults-file=~/.freelamp -p ‘

So that I can just use mysql.freelamp to log into DB.

The first step is to import the original exported wpmu DB, it includes all the other users tables(blogs), we’ll remove them later.

I write a rename.sh, to rename the required tables:

-bash-3.2$ cat rename.sh
#!/bin/bash
id=$1
[ -z "$id" ] && echo “Syntax: $0 blog_id” && exit 0
FILE=$id.sql
echo > $FILE

# we ignore this two tables: cas_count cas_image
for t in  posts commentmeta comments links options postmeta terms term_relationships term_taxonomy
do
echo “DROP TABLE IF EXISTS wp_$t ;” >> $FILE
echo ALTER TABLE wp_”$id”_$t RENAME TO wp_$t “;” >> $FILE
done

echo UPDATE wp_options set option_name=\”wp_user_roles\” WHERE option_name=\”wp_”$id”_user_roles\” “;” >> $FILE
echo UPDATE wp_usermeta set meta_key=\”wp_capabilities\” WHERE meta_key=\”wp_”$id”_capabilities\” “;” >> $FILE
echo UPDATE wp_usermeta set meta_key=\”wp_user_level\” WHERE meta_key=\”wp_”$id”_user_level\” “;” >> $FILE

cat $FILE

Check the output of the above script, then run mysql.freelamp < 2.sql ( in the example, $id = 2 ), you should see all the blog contents in original WPMU site now migrated. The remain thing is log in the control panel to change “Media” folder path and PermsLinks Settings.

And remove non-used users also.

At last, you should remove all these not in using other user’s tables.

SQL command: show tables like “wp\__\_%”  can list all the others tables not needed, just filter them to a script and make it like

DROP TABLE IF EXISTS $tablename.

All set.   LOL.

gmail is:unread

Gmail is really fancy and high productivity. Though still need some mental labor to discover features.

I want to mark all my unread messages to be read, though difficult to select.

Use the advance search feature, from the drop down of the search criteria, select “unread messages”, the result will show you the search keywords as “is:unread”.

So just go to the label you want to check all unread, in the input bar, append “is:unread”, it will display all the unread messages for that label.