IBM T61P + uBuntu 装指纹系统
Jan 24th, 2008 by song

IBM T61P + uBuntu 装指纹系统
安装方法

先去http://thinkfinger.sourceforge.net 下载 tf-tool 3.0

或 下载下面的 附件

下下来 是个 压缩包 放在 根目录下

安装 gcc编译环境 libtool pkg-config libpam0g-dev libusb-dev

可使用apt-get更新安装

sudo apt-get install libtool pkg-config libpam0g-dev libusb-dev build-essential

将下下来的压缩包 解压

tar -xzvf thinkfinger-0.3.tar.gz

进入 解压出来的目录

cd thinkfinger-0.3

然后

./configure –with-securedir=/lib/security –with-birdir=/etc/pam_thinkfinger

由于默认的prefix是/usr/local,如果不加此参数,则指纹数据会放在/usr/local/etc/pam_thinkfinger,而 thinkfinger需要用户指纹数据放在/etc/pam_thinkfinger下(上面这个是每个教程 不同的 地方 )

然后

make

sudo make install

下面是配置

sudo tf-tool –acquire
测试是否正常获取指纹数据
需要输入3次测试指纹

sudo tf-tool –verify
验证是否可以正确识别

sudo mkdir -p /etc/pam_thinkfinger
创建需要的目录

sudo gedit /etc/pam.d/common-auth
修改/etc/pam.d/common-auth文件 Read the rest of this entry »

C守护进程 文章来源网络(备用)
Jan 23rd, 2008 by song

C守护进程编写参考
守护进程(Daemon)是运行在后台的一种特殊进程。它独立于控制终端并
且周期性地执                                            
行某种任务或等待处理某些发生的事件。守护进程是一种很有用的进程。
Linux的大多数                                          
服务器就是用守护进程实现的。比如,Internet服务器inetd,Web服务器
httpd等。同时                                          
,守护进程完成许多系统任务。比如,作业规划进程crond,打印进程lpd
等。                                                    

守护进程的编程本身并不复杂,复杂的是各种版本的Unix的实现机制不尽
相同,造成不                                            
同Unix环境下守护进程的编程规则并不一致。这需要读者注意,照搬某些
书上的规则(                                            
特别是BSD4.3和低版本的System V)到Linux会出现错误的。下面将全面介
绍Linux下守                                            
护进程的编程要点并给出详细实例。                                
                                                       

一. 守护进程及其特性                                          
                                                       

守护进程最重要的特性是后台运行。在这一点上DOS下的常驻内存程序TSR
与之相似。其                                            
次,守护进程必须与其运行前的环境隔离开来。这些环境包括未关闭的文
件描述符,控                                            
制终端,会话和进程组,工作目录以及文件创建掩模等。这些环境通常是
守护进程从执                                            
行它的父进程(特别是shell)中继承下来的。最后,守护进程的启动方式
有其特殊之处                                          
。它可以在Linux系统启动时从启动脚本/etc/rc.d中启动,可以由作业规
划进程crond启                                          
动,还可以由用户终端(通常是shell)执行。 Read the rest of this entry »

sheel + php 守护进程
Jan 23rd, 2008 by song

shell查看一个后台运行的PHP程序是否非正常退出
如果退出,利用守护进程自动restart.
类似mysql的safe_mysqld

共3个程序
shstart.sh  负责启动
sh.sh       守护进程主程序
shstop.sh   安全退出守护进程和php程序主体

/**************************/
shstart.sh
#!/usr/local/bin/bash
/home/phpshell/sh.sh &
shpid=”$!”;
echo “$shpid” > /home/phpshell/sh.sid

/**************************/
sh.sh
#!/usr/local/bin/bash

PHP=”/usr/local/bin/php”
PROGRAM=”/www/time.php”

#start dameo
$PHP $PROGRAM &
chpid=”$!”;

echo “$chpid” > /home/phpshell/php.sid
echo “child pid is $chpid”
echo “status is $?”

while [ 1 ]
do
       wait $chpid
       exitstatus=”$?”
       echo “child pid=$chpid is gone, $exitstatus” >> /home/phpshell/phperror.log
       echo `date` >> /home/phpshell/phperror.log
       echo “**************************” >>/home/phpshell/phperror.log

       sleep 10

       $PHP $PROGRAM &
       chpid=”$!”;
       echo “$chpid” > /home/phpshell/php.sid
       echo “next child pid is $chpid”
       echo “next status is $?”
       echo “userkill is $userkill”
done

/******************************/
shstop.sh
#!/usr/local/bin/bash
chpid=”`cat sh.sid`”;
kill $chpid;
echo “kill sh.sh done!”
ps ax|grep php |grep -v grep|awk ‘{print $1}’|xargs kill
sleep 2
ps ax|grep php |grep -v grep|awk ‘{print $1}’|xargs kill
echo “kill php done”

利用这个原理,可以实现很多后台程序的吊线问题

ubuntu root
Jan 23rd, 2008 by song

sudo passwd root,设置root密码

[原创]整理FreeBSD 7.0 安装 ipvs carp 做LVS
Jan 16th, 2008 by song

安装FreeBSD 默认 mini安装
安装完后
reboot
sysinstall
配置添加
sys/src
ports
安装后重启
reboot

以下步骤如果版本较新可省略
Ports安装准备:
cp /usr/share/examples/cvsup/ports-supfile /etc
cp /usr/share/examples/cvsup/stable-supfile /etc
chmod 664 /etc/ports-supfile
#修改为:*default host=cvsup.cn.FreeBSD.org
vi /root/ports-supfile
(6.2以上直接用csup就好了,不用装cvsup,用法跟cvsup一样的,是cvsup的c重写版 )
csup -g -L 2 /etc/stable-supfile
csup -g -L 2 /etc/ports-supfile

rehash


[code]开始处理内核
a.在核心配置文件中添加对CARP的支持和options NF_SOCKOPT(ipvs需要) 选项
Srv01# cd /usr/src/sys/i386/conf/
Srv01# cp GENERIC LVS
Srv01# vi LVS
添加以下选项:
options                NF_SOCKOPT
device                 carp
b. Freebsd6.1 的uipc_socket.c中没有#include "opt_nfsockopt.h" ,需手动添加否则编译将出错。
vi /usr/src/sys/kern/uipc_socket.c
找到#include "opt_compat.h"这一行,在下面加上 #include "opt_nfsockopt.h"

c. 打ipvs for freebsd6.1补丁(patch)。
Srv01# cd /usr/ports/net/ipvs
Srv01# make patch-system         #具体说明可以查看当前目录下的Makefile

d. 编译核心
Srv01# cd /usr/src/sys/i386/conf
Srv01# config LVS
Srv01# cd ../compile/LVS
Srv01# make depend
Srv01# make
Srv01# make install
Srv01# reboot[/code]
以上来自
http://bbs.chinaunix.net/viewthread.php?tid=862596
关于IPVS补丁替换文件
cp ip_input.c /usr/src/sys/netinet/ip_input.c
cp socketvar.h /usr/src/sys/sys/socketvar.h
cp options /usr/src/sys/conf/options
cp uipc_socket.c /usr/src/sys/kern/uipc_socket.c
关于ipvs补丁部分哪打不上改哪

内核文件操作添加
cd /usr/src/sys/i386/conf/
cp GENERIC RS
修改 部分内容为下面
#cpu            I486_CPU
#cpu            I586_CPU
cpu             I686_CPU
ident           RS
添加
options         NF_SOCKOPT
device          carp
编译内核
方法1:
config RS
cd ../compile/RS
make depend
make
make install
reboot
方法2:
cd /usr/src/
make -j 100 kernel KERNCONF=RS
reboot
方法3
cd /usr/src/
make -j 100 buildkernel KERNCONF=RS
make -j 100 installkernel KERNCONF=RS
reboot
安装IPVS
cd /usr/ports/net/ipvs
make install clean
安装完后没启动 ipvs
装载内核模块
kldload ipvs.ko
kldload ip_vs_rr.ko
卸载内核模块 — 如果不卸载即出现无法关机
kldunload ip_vs_rr
kldunload ipvs

关于热备设置
主机
/etc下
 rc.conf 添加
### add about carp begin
cloned_interfaces=”carp0″
ifconfig_carp0=”vhid 2 pass caisong.com 192.168.1.14/24″
 sysctl.conf添加
net.inet.carp.preempt=1

热备机
/etc下
 rc.conf添加
### add about carp begin
# advskew = backup server
cloned_interfaces=”carp0″
ifconfig_carp0=”vhid 1 advskew 100 pass caisong.com 192.168.1.13/24″
 sysctl.conf添加 关于下面说明 net.inet.carp.preempt=1 设置后为唯一主机
net.inet.carp.preempt=1


安装APACHE22
cd /usr/ports/www/apache22
make install clean
安装完后
设置loader
ee /boot/defaults/loader.conf
accf_http_load=”NO” #Wait for full HTTP request accept filter #将这个”NO”改成”YES”
否则会出现警告信息
No such file or directory: Failed to enable the ‘httpready’ Accept Filter


如需安装mysql
cd /usr/ports/database/mysql51/
make install clean

安装完后
/usr/local/etc/rc.d/mysql-server rcvar | sed s/NO/YES/ >> /etc/rc.conf
/usr/local/etc/rc.d/apache22 rcvar | sed s/NO/YES/ >> /etc/rc.conf
/usr/local/etc/rc.d/mysql-server start
/usr/local/etc/rc.d/apache22 start
mysql 添加远程管理帐户
mysql
GRANT ALL PRIVILEGES ON *.* TO caisong@’localhost’ IDENTIFIED BY ‘密码’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO caisong@’%’ IDENTIFIED BY ‘密码’ WITH GRANT OPTION;

一些其他命令
/etc/netstart 重读rc.conf

[file]attachment/1200463278_0.gz[/file]

OGRE 3D AppWizard 安装在VC9
Jan 2nd, 2008 by song

官方的这个安装引导程序无法在VC9(VS2008)上运行
打开看了下文件JS做的做了点小手术即可运行 修改了下注册表对应的路径


[code]// Ogre SDK Application Wizard
// Copyright (C) 2006 jacmoe
//
// This file is a part of the Ogre Application Wizard.
// The code and information is provided "as-is" without
// warranty of any kind, either expressed or implied.

// Setup program for the Ogre Application Wizard

main();

function main()
{
  var bDebug = false;
  var Args = WScript.Arguments;
  if(Args.length > 0 && Args(0) == "/debug")
    bDebug = true;

  // Create shell object
  var WSShell = WScript.CreateObject("WScript.Shell");
  // Create file system object
  var FileSys = WScript.CreateObject("Scripting.FileSystemObject");

  var strValue = FileSys.GetAbsolutePathName(".");
  if(strValue == null || strValue == "")
    strValue = ".";

  var strSourceFolder = strValue + "\\" + "Files";
  if(bDebug)
    WScript.Echo("Source: " + strSourceFolder);

  if(!FileSys.FolderExists(strSourceFolder))
  {
    WScript.Echo("ERROR: Cannot find Wizard folder (should be: " + strSourceFolder + ")");
    return;
  }

  var strVC8Key = "HKLM\\Software\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir";
  try
  {
    strValue = WSShell.RegRead(strVC8Key);
  }
  catch(e)
  {
    var strVC8Key = "HKLM\\SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\8.0\\Setup\\VC\\ProductDir";
    try
    {
      strValue = WSShell.RegRead(strVC8Key);
    }
    catch(e)
    {
      WScript.Echo("ERROR: Cannot find where Visual Studio 8.0 is installed.");
      return;
    }
  }
  
  var strDestFolder = strValue + "\VCProjects";
  if(bDebug)
    WScript.Echo("Destination: " + strDestFolder);
  if(!FileSys.FolderExists(strDestFolder))
  {
    WScript.Echo("ERROR: Cannot find destination folder (should be: " + strDestFolder + ")");
    return;
  }

  var strDest = strDestFolder + "\\";
  var strSrc = "";

  // Copy files
  try
  {
    strSrc = strSourceFolder + "\\OgreSDKAppWizard80.ico";
    FileSys.CopyFile(strSrc, strDest);
    strSrc = strSourceFolder + "\\OgreSDKAppWizard80.vsdir";
    FileSys.CopyFile(strSrc, strDest);
  }
  catch(e)
  {
    var strError = "no info";
    if(e.description.length != 0)
      strError = e.description;
    WScript.Echo("ERROR: Cannot copy file (" + strError + ")");
    return;
  }

  // Read and write OgreWizard71.vsz, replace path when found
  try
  {
    strSrc = strSourceFolder + "\\OgreSDKAppWizard80.vsz";
    strDest = strDestFolder + "\\OgreSDKAppWizard80.vsz";

    var ForReading = 1;
    var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);
    if(fileSrc == null)
    {
      WScript.Echo("ERROR: Cannot open source file " + strSrc);
      return;
    }

    var ForWriting = 2;
    var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);
    if(fileDest == null)
    {
      WScript.Echo("ERROR: Cannot open destination file" + strDest);
      return;
    }

    while(!fileSrc.AtEndOfStream)
    {
      var strLine = fileSrc.ReadLine();
      if(strLine.indexOf("ABSOLUTE_PATH") != -1)
        strLine = "Param=\"ABSOLUTE_PATH = " + strSourceFolder + "\"";
      fileDest.WriteLine(strLine);
    }

    fileSrc.Close();
    fileDest.Close();
  }
  catch(e)
  {
    var strError = "no info";
    if(e.description.length != 0)
      strError = e.description;
    WScript.Echo("ERROR: Cannot read and write OgreSDKAppWizard80.vsz (" + strError + ")");
    return;
  }

  WScript.Echo("Ogre SDK Application Wizard successfully installed - enjoy!");
}[/code]

SIDEBAR
»
S
I
D
E
B
A
R
«
»  Substance:WordPress   »