首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

linux rsync + inotify搭建实时网页发布同步系统

#如果不加这行strict modes = false,可能会出现@ERROR: auth failed on module mysql strict modes = false #只允许192.168.1.0 网段下的客户端同步,也可指定IP。www.linuxidc.com 多个IP用逗号且无空格连接,如192.168.1.2,192.168.1.3 #也可用:hosts deny = 0.0.0.0/32 hosts allow = 192.168.0.166/32 log file = /var/log/rsyncd.log #pid file = /var/run/rsyncd.pid #指定rsync的pid文件,可不用。#motd file = /etc/rsyncd.motd #欢迎信息文件名称和存放位置(此文件没有,可以自行添加) #lock file = /var/run/rsync.lock #指定支持max connections参数的锁文件,默认值 #max connections = 10   # 最大连接数为10 [web]  #指定认证的备份模块名为mysql,在client端需要指定 #备份路径 path= /var/www #验证用户,这行如果不用,则可匿名访问,多个用户用逗号“,”分隔 #不建议用root。 auth users = wangzi #备份以什么用户ID和组ID进行,也可用root #但建议用mysql用户去读,只要设置有足够权限的用户即可,不建议用root. uid = root gid = root # 可以忽略一些无关的IO错误 ignore errors #不允许列文件 list = false #密码验证文件:username:password secrets file = /etc/rsyncd.secrets #关闭只读,可以上传 read only = no write only = no #pid file = /var/run/rsyncd.pid #log file = /var/log/rsyncd.log #lock file = /var/run/rsync.lock #trict modes = false,可能会出现@ERROR: auth failed on module mysql #只允许192.168.1.0 网段下的客户端同步,也可指定IP。www.linuxidc.com 多个IP用逗号 #motd file = /etc/rsyncd.motd #欢迎信息文件名称和存放位置(此文件没有,可以自行>添加) #lock file = /var/run/rsync.lock #指定支持max connections参数的锁文件,默认值

04

程序员不常用Linux命令集

1) 关闭指定网卡,如关闭网卡eth0 ifconfig eth0 down 也可以使用ifdown,通常ifdown是一个指向ifup的软链接,而ifup为一个脚本文件。 2) 命令自启动,如希望机器重启时自动关闭网卡eth0 这个只需要在文件/etc/rc.d/rc.local中添加一行“ifconfig eth0 down”即可。 3) 进入MySQL终端界面示例: mysql -h127.0.01 -P3306 -uroot -p'password' database 127.0.0.1为DB的IP地址,3306为DB的服务端口号,root为访问它的用户名,password为访问它的密码,databse为需要访问的数据库 参数database是可选的,建议password使用单引号括起来,以避免shell对它进行转义处理,比如如果密码中包含感叹号字符"!",使用双引号时需要使用斜杠“\”转义。 如果不想进入MySQL界面,只需要在上述基础上再带上参数“-e'SQL'”,如: mysql -h127.0.01 -P3306 -uroot -p'password' test -e'show tables' 4) MySQL授权指定IP连接: grant all on *.* to root@'127.0.0.1' identified by 'root110'; 其中root为访问数据库的用户名,而root110为用户的密码。 5) MySQL导入带中文的SQL: mysql -uroot -proot110 table < table.sql -f --default-character-set=utf8 要注意加上-f --default-character-set=utf8 6) MySQL导出数据库表: mysqldump -uroot -p db_name > db.sql(root为访问数据库的用户名,-p表示需要输入密码,db_name为需要导出的数据库名,db.sql为存储导出结果的文件) 如果只想导出指定的表,则可在db_name后留一空格后跟上表名即可。 7) 重启Linux服务,如重启cron: service cron restart 将上面的restart改成stop为停止,改成start为启动。 8) 网络访问策略: 禁止指定网段访问(24对应的掩码为255.255.255.0): iptables -I INPUT -s 10.6.208.0/24 -j DROP iptables -I INPUT -s 10.6.223.0/24 -j DROP iptables -I INPUT -s 10.6.224.0/24 -j DROP 为保证上述操作在机器重启后仍然有效,执行以下操作: iptables-save > /etc/sysconfig/iptables 这样IP地址:10.6.208.101、10.6.223.31和10.6.224.219等就不能访问目标机器了。 9) 日期操作 # date +%s 1479791653 # date --date='@1479791653' Tue Nov 22 13:14:13 CST 2016 10) 查找进程工作目录命令: pwdx 如: pwdx `pidof test`

02
领券