摘要: systemd提供自己的日志文件系统(logging system),成为journal,使用systemd日志,无需额外安装日志服务(rsyslog) 配置文件/etc/systemd/journald.conf 默认情况下(当Storage=auto,配置文件/etc/systemd/journ 阅读全文
posted @ 2020-09-22 20:23 ascertain 阅读(880) 评论(0) 推荐(0) 编辑
摘要: C语言中我们经常使用DEBUG宏来控制是否输出调试信息,在shell脚本中,同样可以使用相同机制 if [[ "$DEBUG" == true ]];then echo 'DEBUGGING' fi 这样的代码块称之为 "调试钩子" 或 "调试块",在调试钩子内部可以输出调试信息,使用调试钩子的好处 阅读全文
posted @ 2020-09-22 18:27 ascertain 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 判断变量是否相等,最好使用 != == ,而 -ne -eq -gt -lt -ge -le 适用于int类型比较 int和float使用-ne发生错误 int和float使用 != 没有问题当变量不存在时的情况 [ ]进行判断时,报错 替换成 != 和 == 正确[[ ]]的情况: 没有报错,但是 阅读全文
posted @ 2020-09-22 17:33 ascertain 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 服务器有公网IP开启ssh,需要做防暴力破解,pam中有个模块可以帮助我们限定用户登录的失败次数,达到指定阈值,锁定用户 一:ssh远程登录限制 在/etc/pam.d/sshd文件中添加配置 auth required pam_tally2.so deny=3 unlock_time=3600 e 阅读全文
posted @ 2020-09-22 16:27 ascertain 阅读(10102) 评论(1) 推荐(1) 编辑
摘要: cut Usage: cut OPTION [FILE] Print selected parts of lines from each FILE to standard output -b --bytes=LIST 以字节为单位进行分割。这些字节位置将忽略多字节字符边界,除非也指定了 -n 标志。 阅读全文
posted @ 2020-09-22 15:41 ascertain 阅读(166) 评论(0) 推荐(0) 编辑
摘要: fore-end 分发器: #!/bin/env bash host=$1 interval=$2 project=$3 echo $host echo $interval for b in `IFS=$',';echo $project`;do echo $b #echo "$IFS"|xxd - 阅读全文
posted @ 2020-09-22 15:07 ascertain 阅读(479) 评论(0) 推荐(0) 编辑
摘要: seq用于生成一个序列 seq [option] first increment last 选项: -f --format=FORMAT 使用 printf 样式的浮点格式 -s --separator=STRING 使用指定字符串分隔数字(默认:\n) -w --equal-width 在数字添加 阅读全文
posted @ 2020-09-22 10:36 ascertain 阅读(148) 评论(0) 推荐(0) 编辑
摘要: C风格 #!/bin/env sh function mat(){ for ((p=0;p<10;p++)) do echo $p done } mat {start..end..step} #!/bin/env sh function mat(){ for p in {10..1..2} do e 阅读全文
posted @ 2020-09-22 10:09 ascertain 阅读(93) 评论(0) 推荐(0) 编辑