系统服务和日志

回复 收藏

系统服务

ntsysv     安装命令  yum install  -y ntsysv

重启系统生效

chkconfig   --list   列出所有服务状态    运行级别分列

chkconfig atd  off    关闭atd 服务   起作用的是2到5级别

--level 3   指定级别3      指定多个级别

/etc/init.d    服务列表

--add   加入服务

--del    删除服务

关闭服务是指不让自动启动、不是立即关闭

linux   系统日志

出现故障、查看日志

/var/log/messages      日志文件   内核的相关信息

/var/log/wtmp   查看用户登录历史

/var/log/btmp   查看失败登录

/var/log/maillog    邮件服务

/var/log/secure    ftp登录失败记录

/var/log/dmesg     系统启动过程中硬件相关的日志

dmesg    查看实时更新的硬件信息   获取硬件的错误信息

cat /etc/logrocate.conf   日志配置文件

/etc/logrotate.d/suslog     日志文件路径

exec  xargs

find  /var/log/ -type f  -mtime  +10  -exec cp {} {}.bak \;

find  /var/log/ -type f  -mtime  +10 | xargs -i cp {} {}.bak\;

screen  工具

nohup   不会出现中断  输出日志到 hohup.out

creen    安装命令  yum  install   -y  screen

直接回车进去screen    在里面运行命令  再后台运行

ctrl + a  + d   退出screen

screen  -ls  查看后台运行的screen

-r  +id 号或者名字  进去对应的screen

-S  更改名字

真正断开  ctrl +d

curl  工具

命令行里访问web

-I

省略源代码

状态码  200 301 302 404 403 502 503   只有200是正常的

-x  代理

-u  username :password +地址

-o  +改名字  + 地址

-O   直接加地址  下载图片

rsync

拷贝数据 同步数据

支持网络通信

用作备份

pull   远程拉到本地

push  本地数据推送到远程

-av

--del   同步删除数据

--exclude  排除某个目录

-P      同步过程的进度

-u     避免把目标机器上的新数据覆盖

-L    同步实体文件 (软连接)

-z     压缩

目录后加  /   代表同步目录和文件

ssh  默认端口是  22

如果端口没有开启  可以加命令  -e  “ssh  -p  10022”   使用10022  端口

后台服务

vim /etc/rsyncd.conf        自动加载  不用指定

port=873

log file =/var/log/rsync.log

pid file =/var/run/rsync,pid

[awan]

path=

use chroot=

max connections=

read noly=

list=

uid=

gid=

auth users=

secrets file=

hosts allow=

rsync --daemon   启动

2017-04-18 22:33 举报
已邀请:

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: