|||
管理服务开机启动(windows 里面使用 msconfig)
在Linux里面
[root@localhost ~]# rpm -qf `which ntsysv`
ntsysv-1.3.49.3-2.el6_4.1.i686
[root@localhost ~]# yum list|grep ntsysv
ntsysv.i686 1.3.49.3-2.el6_4.1 @anaconda-CentOS-201311271240.i386/6.5
ntsysv.i686 1.3.49.3-5.el6 base
这里表示ntsysv已经安装了。
[root@localhost ~]# chkconfig –list(和命令ntsysv的结果一样)
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
bluetooth 0:off 1:off 2:off 3:on 4:on 5:on 6:off
cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot 0:off 1:off 2:off 3:on 4:off 5:on 6:off
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
htcacheclean 0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
irqbalance 0:off 1:off 2:off 3:on 4:on 5:on 6:off
kdump 0:off 1:off 2:off 3:on 4:on 5:on 6:off
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
nmb 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
portreserve 0:off 1:off 2:on 3:on 4:on 5:on 6:off
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off
quota_nld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rngd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rpcgssd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rpcsvcgssd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
smartd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
smb 0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmptrapd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
spice-vdagentd 0:off 1:off 2:off 3:off 4:off 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off
udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off
vmware-tools 0:off 1:off 2:on 3:on 4:on 5:on 6:off
vmware-tools-thinprint 0:off 1:off 2:on 3:on 4:on 5:on 6:off
wdaemon 0:off 1:off 2:off 3:off 4:off 5:off 6:off
winbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
xinetdbased services:
chargen-dgram: off
chargen-stream: off
daytime-dgram: off
daytime-stream: off
discard-dgram: off
discard-stream: off
echo-dgram: off
echo-stream: off
rsync: off
swat: off
tcpmux-server: off
time-dgram: off
time-stream: off
修改服务的level
[root@localhost ~]# chkconfig --level 3 sendmail on
删除一个服务
[root@localhost ~]# chkconfig --del sendmail
启动文件所在的位置
[root@localhost ~]# ls /etc/init.d
abrt-ccpp httpd nmb single
abrtd ip6tables ntpd smartd
abrt-oops iptables ntpdate smb
acpid irqbalance portreserve snmpd
atd kdump postfix snmptrapd
auditd killall psacct spice-vdagentd
blk-availability lvm2-lvmetad quota_nld sshd
bluetooth lvm2-monitor rdisc sysstat
cpuspeed mdmonitor restorecond udev-post
crond messagebus rngd vmware-tools
cups mysqld rpcbind vmware-tools-thinprint
dnsmasq netconsole rpcgssd wdaemon
firstboot netfs rpcidmapd winbind
functions network rpcsvcgssd wpa_supplicant
haldaemon NetworkManager rsyslog xinetd
halt nfs sandbox
htcacheclean nfslock saslauthd
查看系统服务日志,用来排错和追踪问题
[root@localhost ~]# ls /var/log/messages
/var/log/messages
[root@localhost ~]# ls /var/log/messages(连续两次tab键)
messages messages-20150830 messages-20150906 messages-20150914
系统会根据日志文件的大小进行分割,新的文件是messages,其他的都是已经分割过的,这个分割怎么控制?有个系统文件/etc/logrotate.conf
[root@localhost ~]# cat /etc/logrotate.conf
#see "man logrotate" for details
#rotate log files weekly
weekly
#keep 4 weeks worth of backlogs
rotate4
#create new (empty) log files after rotating old ones
create
#use date as a suffix of the rotated file
dateext
#uncomment this if you want your log files compressed
#compress
#RPM packages drop log rotation information into this directory
include/etc/logrotate.d
#no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp{
monthly
create 0664 root utmp
minsize 1M
rotate 1
}
/var/log/btmp{
missingok
monthly
create 0600 root utmp
rotate 1
}
#system-specific logs may be also be configured here.
[root@localhost ~]# ps aux|grep syslog
root 1551 0.0 0.1 35972 1496 ? Sl 00:36 0:00 /sbin/rsyslogd -i/var/run/syslogd.pid -c 5
gdm 2235 26.7 0.3 102068 3812 ? Ssl 00:36 0:20 /usr/bin/pulseaudio --start --log-target=syslog
root 2301 0.0 0.0 4360 728 pts/0 S+ 00:37 0:00 grep syslog
有两个syslog,一个有r,表示远程。
[root@localhost ~]# grep -v '^$' /etc/rsyslog.conf |grep -v '^#' (去掉空格行)
$ModLoadimuxsock # provides support for local system logging (e.g. via logger command)
$ModLoadimklog # provides kernel loggingsupport (previously done by rklogd)
$ActionFileDefaultTemplateRSYSLOG_TraditionalFileFormat
$IncludeConfig/etc/rsyslog.d/*.conf
*.info;mail.none;authpriv.none;cron.none /var/log/messages
authpriv.* /var/log/secure
mail.* -/var/log/maillog
cron.* /var/log/cron
*.emerg *
uucp,news.crit /var/log/spooler
local7.* /var/log/boot.log
$templateSpiceTmpl,"%TIMESTAMP%.%TIMESTAMP:::date-subseconds% %syslogtag%%syslogseverity-text%:%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%n"
:programname,startswith, "spice-vdagent" /var/log/spice-vdagent.log;SpiceTmpl
[root@localhost ~]# cat /etc/logrotate.d/syslog
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
sharedscripts
postrotate
/bin/kill -HUP `cat/var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
[root@localhostetc]# lastb (失败的登陆),对应的日志是:ls /etc/log/btmp
btmpbegins Wed Sep 2 19:46:01 2015
[root@localhost etc]# find /root/ -type f |xargs -n1 -i{} du -sh {}
[root@localhost etc]# find /root/ -type f -exec du -sh {} ;
命令 screen是个虚拟屏幕,关闭终端仍在运行
[root@localhost ~]# curl -I www.baidu.com
HTTP/1.1200 OK(200表示正常,404表示无法访问,302表示跳转)
Date:Tue, 15 Sep 2015 08:22:05 GMT
Content-Type:text/html; charset=utf-8
Connection:Keep-Alive
Vary:Accept-Encoding
Set-Cookie:BAIDUID=EBA8BF55C8A5F6A25C2A691271E801B3:FG=1; expires=Thu, 31-Dec-37 23:55:55GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie:BIDUPSID=EBA8BF55C8A5F6A25C2A691271E801B3; expires=Thu, 31-Dec-37 23:55:55 GMT;max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie:PSTM=1442305325; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647;path=/; domain=.baidu.com
Set-Cookie:BDSVRTM=0; path=/
Set-Cookie:BD_HOME=0; path=/
Set-Cookie:H_PS_PSSID=16611_1460_17231_17156_12824_12867_16937_17262_17181_17000_17004_17072_15033_11767_13932_17051;path=/; domain=.baidu.com
P3P:CP=" OTI DSP COR IVA OUR IND COM "
Cache-Control:private
Cxy_all:baidu+d1347e9b361f59e25da053e0e5daa361
Expires:Tue, 15 Sep 2015 08:21:22 GMT
X-Powered-By:HPHP
Server:BWS/1.1
X-UA-Compatible:IE=Edge,chrome=1
BDPAGETYPE:1
BDQID:0x92a191bd0001fe82
BDUSERID:0
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-1-15 16:13
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社