Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1417403
  • 博文数量: 122
  • 博客积分: 340
  • 博客等级: 一等列兵
  • 技术积分: 2967
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-01 11:50
个人简介

说点什么呢

文章分类

全部博文(122)

文章存档

2018年(2)

2017年(1)

2015年(2)

2014年(30)

2013年(81)

2011年(5)

2009年(1)

分类: LINUX

2013-12-04 10:30:34

二十九、BASH,TCSH,ZSH和它们的配置文件及其阅读的顺序

BASH:

在启动时顺序读下列文件:/etc/profile , ~/.bash_profile, ~/.bash_login, ~/.profile 

在退出时读下列文件:~/.bash_logout

   TCSH:

在启动时读下列文件:/etc/csh.cshrc, ~/.bash_login, ~/.tcshrc(如果没有这个文件,则读~/.cshrc),~/.history,~/.login,~/.cshdirs,和 ~/.profile

ZSHzsh在启动的时候阅读以下这些文件:/etc/zshenv, ~/.zshenv, 

/etc/zprofile, ~/.zprofile, /etc/zshrc, ~/.zshrc/etc/zlogin.  不登陆时也会读~/.bashrc

退出时读 ~/.zlogout /etc/zlogout文件

三十、关于/etc/fstab文件

Fstab文件包含了文件系统的重要信息,如分区的文件系统的类型、及他们挂接在磁盘的分区位置和什么挂接点将访问它们等。

fsck会在系统启动的时候对这个文件里所列的文件系统进行检查,除非这个文件所列的文件系统对应的这一行的最后列的值是0

Fstabl文件中共有六列,这六列的含义什么是:

第一列:描述了文件系统;

第二列:表示挂接点;

第三列:描述了文件系统的类型,一般为ext3, ext2, auto等等;

第四列:是挂接文件系统时所需的一些选项,如defaults,noauto(不自动挂接)等等;

第五列:其取值只能是0或者1,这些值决定着dump是否备份这些文件系统,1

示是,0表示否;

最后列:表示fsck检查这个文件系统的顺序;

三十一、关于logrotate.conf 文件

Logrotate.conf logrotate.d下的文件决定了日志文件多长时间被轮换一次(即多长时间覆盖掉旧的文件及保证多少个旧的日志文件)。Logrotate程序能够自动的轮换、压缩、删除和利用email方式发送日志文件。日志文件可以按照日志文件的大小、时间(如每天、每个星期或每个月)来轮换。

对于那些在logrotate.d下有独立的日志轮转配置文件,并且使用syslogd来记录日志的,那在syslog.conf里也应该有对应的条目跟它对应。这是因为syslog需要为这些程序将日志信息独立的保存上一个独立的文件中以便日志文件能够独立的轮转。

三十二、/etc/sysconfig目录下的配置文件

/etc/sysconfig目录下的配置文件多种多样,这些文件设置了系统硬件的参数以及系统服务的情况。下面介绍这个目录下的几个常见的文件:

Apmd: 高级电源管理配置文件,这个文件对于笔记本来说比服务器更有用,因为它许多关于linux机器什么时候进入挂起状态及什么时候恢复的信息。同时它还包括了当电池电量偏低的时候什么时候给出报警以及当机器从挂起状态恢复的时候是否和硬件进行时钟同步等信息。

Clock: 这个文件包含了机器的时区以及是否使用格林尼制时间等信息;

Amd: amd是一个文件系统自动挂接的进程。当一个没有被挂接的文件系统被访问时,这个进程什么自动挂接上,而当访问结束后文件系统又会被umount掉。

   

三十三、删除大量文件

             在linux 下如果要删除大量的文件,如果直接用户 rm rf * 删除时,则会报

         参数太长的错误。这是因为*shell扩展了,所以就报参数太长,这时可以使用

         以下命令来删除这些文件

ls  | xargs rm  -rf  

三十四、rpm 命令使用技巧

      a. 校检系统足是否已经误删了文件或有文件损坏

rpm Va

如果有误删的文件或有损坏的文件,重新安装对应的软件包

如直接输入上述命令,则系统返回如下信息

.M......    /root

.M......    /tmp

.M......    /var/log

.M......    /etc/cups

S.5....T  c /etc/cups/cupsd.conf

S.5....T  c /etc/cups/printers.conf

.M5....T  c /etc/xinetd.d/cups-lpd

missing     /var/log/cups

.M......    /var/spool/cups/tmp

.......T  c /etc/httpd/conf.d/ssl.conf

S.5....T  c /etc/xinetd.d/rexec

S.5....T  c /etc/xinetd.d/rlogin

S.5....T  c /etc/xinetd.d/rsh

S.5....T  c /etc/xinetd.d/finger

S.5....T    /usr/share/firstboot/modules/eula.pyc

.....UG.    /usr/libexec/mysqld

S.5....T  c /etc/inittab

.......T  c /etc/libuser.conf

等等

      b. 查看一个文件需于哪个软件包,如在系统碰到了自己不认识的文件,则可以

rpm qf /etc/zshrc

则系统返回如下信息:zsh-4.2.0-3 ,则说明这个文件是需于zsh-4.2.0-3个软件包的。

       c. 如果发生综合以上两个例子的情况如文件/usr/bin/paste出了问题。您想

          知道哪个软件包中包含该文件,您这时可以简单的键入:

           rpm -Vf /usr/bin/paste

          则系统返回如下信息:

       d. 如果要想知道一个新的软件里所包含的文件及安装脚本,可以使用下列命令

          rpm -qlp --scripts MySQL-server-standard-4.1.22-0.rhel4.i386.rpm

          则系统返回如下信息

          warning: MySQL-server-standard-4.1.22-0.rhel4.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

preinstall scriptlet (using /bin/sh):

# Shut down a previously installed server first

if test -x /etc/init.d/mysql

then

   /etc/init.d/mysql stop > /dev/null 2>&1

   echo "Giving mysqld a couple of seconds to exit nicely"

   sleep 5

elif test -x /etc/rc.d/init.d/mysql

then

   /etc/rc.d/init.d/mysql stop > /dev/null 2>&1

   echo "Giving mysqld a couple of seconds to exit nicely"

   sleep 5

fi

postinstall scriptlet (using /bin/sh):

mysql_datadir=/var/lib/mysql

# Create data directory if needed

if test ! -d $mysql_datadir; then mkdir -m755 $mysql_datadir; fi

if test ! -d $mysql_datadir/mysql; then mkdir $mysql_datadir/mysql; fi

if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; fi

# Make MySQL start/shutdown automatically when the machine does it.

# use insserv for older SuSE Linux versions

if test -x /sbin/insserv

then

         /sbin/insserv /etc/init.d/mysql

# use chkconfig on Red Hat and newer SuSE releases

elif test -x /sbin/chkconfig

then

         /sbin/chkconfig --add mysql

fi

# Create a MySQL user and group. Do not report any problems if it already

# exists.

groupadd -r mysql 2> /dev/null || true

useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL  server" -g mysql mysql 2> /dev/null || true 

# The user may already exist, make sure it has the proper group nevertheless (BUG#12823)

usermod -g mysql mysql 2> /dev/null || true

# Change permissions so that the user that will run the MySQL daemon

# owns all database files.

chown -R mysql:mysql $mysql_datadir

# Initiate databases

/usr/bin/mysql_install_db --rpm --user=mysql

# Change permissions again to fix any new files.

chown -R mysql:mysql $mysql_datadir

# Fix permissions for the permission database so that only the user

# can read them.

chmod -R og-rw $mysql_datadir/mysql

# Restore selinux file_context

if [ -x sbin/restorecon ]; then

         sbin/restorecon -R var/lib/mysql

fi

# Restart in the same way that mysqld will be started normally.

/etc/init.d/mysql start

# Allow safe_mysqld to start mysqld and print a message before we exit

sleep 2

preuninstall scriptlet (using /bin/sh):

if test $1 = 0

then

         # Stop MySQL before uninstalling it

   if test -x /etc/init.d/mysql

   then

    /etc/init.d/mysql stop > /dev/null

     # Remove autostart of mysql

     # for older SuSE Linux versions

     if test -x /sbin/insserv

     then

       /sbin/insserv -r /etc/init.d/mysql

     # use chkconfig on Red Hat and newer SuSE releases

     elif test -x /sbin/chkconfig

     then

       /sbin/chkconfig --del mysql

    fi

   fi

fi

# We do not remove the mysql user since it may still own a lot of

# database files.

# Clean up the BuildRoot

/etc/init.d/mysql

/etc/logrotate.d/mysql

/usr/bin/isamchk

/usr/bin/isamlog

/usr/bin/my_print_defaults

/usr/bin/myisam_ftdump

/usr/bin/myisamchk

/usr/bin/myisamlog

/usr/bin/myisampack

/usr/bin/mysql_convert_table_format

/usr/bin/mysql_create_system_tables

/usr/bin/mysql_explain_log

/usr/bin/mysql_fix_extensions

/usr/bin/mysql_fix_privilege_tables

/usr/bin/mysql_install_db

/usr/bin/mysql_secure_installation

/usr/bin/mysql_setpermission

/usr/bin/mysql_tzinfo_to_sql

/usr/bin/mysql_zap

/usr/bin/mysqlbug

/usr/bin/mysqld_multi

/usr/bin/mysqld_safe

/usr/bin/mysqldumpslow

/usr/bin/mysqlhotcopy

/usr/bin/mysqltest

/usr/bin/pack_isam

/usr/bin/perror

/usr/bin/replace

/usr/bin/resolve_stack_dump

/usr/bin/resolveip

/usr/bin/safe_mysqld

/usr/lib/mysql/mysqld.sym

/usr/sbin/mysqld

/usr/sbin/rcmysql

/usr/share/doc/MySQL-server-standard-4.1.22

/usr/share/doc/MySQL-server-standard-4.1.22/COPYING

/usr/share/doc/MySQL-server-standard-4.1.22/README

/usr/share/doc/MySQL-server-standard-4.1.22/my-huge.cnf

/usr/share/doc/MySQL-server-standard-4.1.22/my-innodb-heavy-4G.cnf

/usr/share/doc/MySQL-server-standard-4.1.22/my-large.cnf

/usr/share/doc/MySQL-server-standard-4.1.22/my-medium.cnf

/usr/share/doc/MySQL-server-standard-4.1.22/my-small.cnf

/usr/share/info/mysql.info.gz

/usr/share/man/man1/isamchk.1.gz

前面一部分是包含的脚本,后面一部分是包里包含的文件。如果不需要看脚本,则不需要scripts 就可以了

          e. 如果要了解一个软件包干什么的及版本和编译信息可以使用下列命令

rpm -qip  MySQL-server-standard-4.1.22-0.rhel4.i386.rpm

系统返回如下信息

warning: MySQL-server-standard-4.1.22-0.rhel4.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

Name        : MySQL-server-standard        Relocations: (not relocatable)

Version     : 4.1.22                            Vendor: MySQL AB

Release     : 0.rhel4                       Build Date: 2006?ê11??03?? ?????? 14?±03·?37??

Install Date: (not installed)               Build Host: rh-x86-32.mysql.com

Group       : Applications/Databases        Source RPM: MySQL-standard-4.1.22-0.rhel4.src.rpm

Size        : 24832170                         License: GPL

Signature   : DSA/SHA1, 2006?ê11??23?? ?????? 21?±17·?45??, Key ID 8c718d3b5072e1f5

Packager    : MySQL Product Engineering Team 

URL         : 

Summary     : @COMMENT@ for Red Hat Enterprise Linux 4

Description :

The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,

and robust SQL (Structured Query Language) database server. MySQL Server

is intended for mission-critical, heavy-load production systems as well

as for embedding into mass-deployed software. MySQL is a trademark of

MySQL AB.

The MySQL software has Dual Licensing, which means you can use the MySQL

software free of charge under the GNU General Public License

(). You can also purchase commercial MySQL

licenses from MySQL AB if you do not wish to be bound by the terms of

the GPL. See the chapter "Licensing and Support" in the manual for

further info.

The MySQL web site () provides the latest

news and information about the MySQL software. Also please see the

documentation and the manual for more information.

This package includes the MySQL server binary (incl. InnoDB) as well

as related utilities to run and administrate a MySQL server.

If you want to access and work with the database, you have to install

package "MySQL-client-standard" as well!

这里的description说明是一个database server服务器

阅读(863) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~