freebsd apache

2010年3月27日 没有评论

1.报错Freebsd: No such file or directory: Failed to enable the ‘’ Accept Filter
载入模块
vivi#kldload accf_http
vivi#kldload accf_data
重启apache就好了

2.vivi# ./ -k start 无提示,80端口未开

查看日志
vivi# cat /var/log/httpd-error.log
[Sat Mar 27 22:09:46 2010] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of “vivi”

编辑/usr/local/etc/22/httpd.conf
注释这行 #LoadModule unique_id_module libexec/apache22/mod_unique_id.so

打开/etc/rc.conf设置:

accf_data_load=”YES”
accf_http_load=”YES”
apache22_enable=”YES”

安装、更新ports

2010年3月27日 没有评论

使用 安装/同步ports 系统
使用portsnap不需要事先安装 tree,并且能够在任何时候恢复到已知的最新状态(即使手工对ports tree进行了修改)。

第一次使用:portsnap fetch extract
以后使用更新:portsnap fetch update
放在cron里运行:portsnap cron

对比更新 vbs

2010年3月26日 没有评论
  1. Option Explicit
  2.  
  3. sub copyfol(sDir,Ddir)
  4.  'sDiry要对比的文件夹,,Ddir要操作文件夹
  5.    dim fso,fol,fs,f1, objfile
  6.    dim arrFiles(),arrSize(),arrModified()
  7.    dim i
  8.    if right(ddir,1)<>"\" then ddir =ddir & "\"
  9.    if right(sdir,1)<>"\" then sdir =sdir & "\"
  10.    Set fso = CreateObject("Scripting.FileSystemObject")
  11.    '判断文件是否存在
  12.    if not (fso.FolderExists(sdir))  then
  13.        msgbox "找不到文件夹:" & sdir
  14.        exit sub
  15.    end if
  16.    if not (fso.FolderExists(ddir))  then
  17.         msgbox "找不到文件夹:" & sdir
  18.         exit sub
  19.    end if
  20.  
  21.    '获得要操作的文件列表及相关信息并储存到数组
  22.    set fol=fso.GetFolder(ddir)
  23.    set fs=fol.files
  24.    i=0
  25.    redim arrFiles(fs.count-1)
  26.    redim arrSize(fs.count-1)
  27.    redim arrModified(fs.count-1)
  28.    for each f1 in fs
  29.       arrfiles(i)=f1.name
  30.       arrSize(i)=f1.size
  31.       arrModified(i)=f1.DateLastModified
  32.       i=i+1
  33.    next
  34.    '把要操作的文件夹逐一根要对比的文件比较,不同则覆盖,多余就删除,没有就复制
  35.    set fol=fso.GetFolder(sdir)
  36.    set fs=fol.files
  37.    for i = 0 to ubound(arrfiles)
  38.        '文件存在则比较是否相同,否则删除
  39.  
  40.        dim delfile  '要操作类型,
  41.        delfile=false
  42.        for each f1 in fs
  43.            if strcomp(arrfiles(i),f1.name,vbTextCompare)=0 then             
  44.                if arrsize(i)<> f1.size or arrModified(i)<>f1.DateLastModified then
  45.                   fso.copyfile f1.path, ddir & arrfiles(i),true       
  46.                end if
  47.                delfile=true '如果文件存在
  48.                exit for
  49.             end if
  50.         next
  51.         if not delfile then                 
  52.             set objfile=fso.getfile(ddir &arrfiles(i))
  53.             objfile.Delete (true)
  54.          end if         
  55.     next
  56.    '如果对比目录sdir中有文件是要操作目录ddir中没有的,则复制到ddir
  57.    for each f1 in fs
  58.        delfile=false
  59.        for i=0 to ubound(arrfiles)
  60.           if strcomp(f1.name,arrfiles(i),vbtextcompare)=0 then
  61.              delfile=true
  62.              exit for
  63.           end if
  64.         next
  65.          if right (ddir,1)<>"\" then ddir=ddir &"\"
  66.         if not delfile then         
  67.            f1.copy ddir,true
  68.         end if
  69.    next
  70.    '以下代码处理子文件夹 
  71.    dim fols
  72.    set fol=Fso.GetFolder(sdir)
  73.    set fols=fol.SubFolders
  74.    for each f1 in fols
  75.       if not (fso.FolderExists(ddir & f1.name)) then
  76.          fso.CreateFolder(ddir & f1.name)
  77.       end if
  78.       copyfol sdir & f1.name ,ddir & f1.name
  79.    next
  80. end sub
  81.  
  82.    '以下是对比路径 第一个是远程路径 第二个是本地路径
  83. copyfol "c:\viyin.net","C:\www.viyin.net"

nginx平台架设nagios

2010年3月23日 3 条评论

nagios作用
1.
监控网络服务(SMTP、POP3、HTTP、NNTP、PING等);
2.
监控主机资源(处理器负荷、磁盘利用率等);
3.
简单地插件设计使得用户可以方便地扩展自己服务的检测方法;
4.
并行服务检查机制;
5.
具备定义网络分层结构的能力,用”parent”主机定义来表达网络主机间的关系,这种关系可被用来发现和明晰主机宕机或不可达状态;
6.
当服务或主机问题产生与解决时将告警发送给联系人(通过EMail、短信、用户定义方式);
7.
具备定义事件句柄功能,它可以在主机或服务的事件发生时获取更多问题定位;
8.
自动的日志回滚;
9.
可以支持并实现对主机的冗余监控;
10.
可选的WEB界面用于查看当前的网络状态、通知和故障历史、日志文件等;
Nagios所需要的运行条件是机器必须可以运行Linux(或是Unix变种)并且有C语言编译器。你必须正确地配置TCP/IP协议栈以使大多数的服务检测可以通过网络得以进行。

安装

建立nagios账号
/usr/sbin/useradd && passwd

创建一个用户组名为nagcmd用于从Web接口执行外部命令。将nagios用户和apache用户都加到这个组中。

  1. /usr/sbin/groupadd nagcmd
  2. /usr/sbin/usermod -G nagcmd nagios
  3. /usr/sbin/usermod -G nagcmd apache

安装nagios及插件
阅读全文…

h3c交换机启用snmp

2010年3月17日 没有评论
  1. snmp-agent
  2.  snmp-agent community read viyin.net
  3.  snmp-agent sys-info version all

测试 -v 2c -c 0511idc 222.186.*.* if

[root@vi ~]# snmpwalk -v 2c -c 0511idc 222.186.*.* if
IF-MIB::ifIndex.14 = INTEGER: 14
IF-MIB::ifIndex.16 = INTEGER: 16
IF-MIB::ifIndex.31 = INTEGER: 31
IF-MIB::ifIndex.823 = INTEGER: 823
IF-MIB::ifIndex.1623 = INTEGER: 1623
IF-MIB::ifIndex.8015 = INTEGER: 8015
IF-MIB::ifIndex.8031 = INTEGER: 8031
IF-MIB::ifIndex.8047 = INTEGER: 8047
IF-MIB::ifIndex.4227614 = INTEGER: 4227614
IF-MIB::ifIndex.4227625 = INTEGER: 4227625
IF-MIB::ifIndex.4227633 = INTEGER: 4227633
IF-MIB::ifIndex.4227641 = INTEGER: 4227641
IF-MIB::ifIndex.4227649 = INTEGER: 4227649
IF-MIB::ifIndex.4227657 = INTEGER: 4227657
.
.
.
IF-MIB::ifSpecific.4227649 = OID: SNMPv2-SMI::zeroDotZero
阅读全文…

分类: √思科华为 标签: , ,

dnf

2010年3月16日 没有评论

@echo off
type D:\1\_CHINA.CFG | find /i “NOTIFYING_MINIMAP=1″ &&echo on &&goto run

for /l %%a in (1,1,10) do (

type D:\DNF1\DNF_CHINA.CFG | find /i “NOTIFYING_MINIMAP=1″ &&echo on &&goto run

ping 127.1 -n 2 >nul

)

exit

:run
@echo off

for /f “delims=” %%i in (‘dir /b/s/a-d “D:\DNF1\DNF_CHINA.CFG”‘) do (
findstr /v “[CH” “%%i” >”%%~dpni.new”
del /q “%%i”
ren “%%~dpni.new” “%%~ni.CFG”
)

for /f “delims=” %%i in (‘dir /b/s/a-d “D:\DNF1\DNF_CHINA.CFG”‘) do (
findstr /v “NOTIFYING_” “%%i” >”%%~dpni.new”
del /q “%%i”
ren “%%~dpni.new” “%%~ni.CFG”
)

exit

linux

2010年3月16日 1 条评论

chmod 751 /bin
chmod 751 /selinux
chmod 751 /var
chmod 751 /media
chmod 751 /mnt
chmod 751 /sbin
chmod 751 /etc
chmod 751 /boot
chmod 751 /lib
chmod 755 /dev
chmod 751 /usr
chmod 751 /srv
chmod 751 /misc
chmod 755 /sys
chmod 751 /opt
chmod 751 /home
chmod 551 /proc
chmod 751 /usr/local/
chmod 751 /usr/local/mysql
chmod 751 /usr/local/mysql/bin
chmod 751 /usr/local/nginx/conf/
chmod 751 /usr/local/nginx/conf/viyin.net
chmod -R 700 /etc/rc.d/init.d/*

chattr +i /etc/passwd
chattr +i /etc/shadow
chattr +i /etc/group
chattr +i /etc/gshadow

web根目录
chown root:root /data/web
chmod 751 /data/web
chown www:root /usr/local/nginx/conf/

参考
chmod go-rx /etc/rc.d/init.d
chmod o-r /etc/rc.d/init.d/* //去掉几个目录的列权限

chmod go-rx /usr/bin/gcc
chmod go-rx /usr/bin/g++
chmod go-rx /usr/include //去掉glibc的其他用户的权限

cd /
chmod o-r *
cd /usr
chmod o-r *
cd /var
chmod o-r *
chmod go-r /etc/httpd/conf

分类: √linux 标签: