随笔分类 -  shell

摘要:1.使用场景说明 如果想使用我们的systemctl管理shell脚本开机自启动,可以试试如下方法 2.systemctl管理配置中 #要使用systemctl开机启动的脚步路径ls /data/shell/SO/container_management.sh #配置systemctl管理文件 [r 阅读全文
posted @ 2024-06-13 18:21 Leonardo-li 阅读(323) 评论(0) 推荐(0) 编辑
摘要:1.wget下载Gitlab项目下整个分支的的存档,download_branch_archive.sh #!/bin/bash # GitLab 实例的地址 GITLAB_HOST="172.16.88.5" # 项目 ID PROJECT_ID="108" # 分支名称 BRANCH="Stan 阅读全文
posted @ 2024-05-07 15:30 Leonardo-li 阅读(220) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash # 密码 password="your_password_here" # 加密函数 encrypt() { input_file="$1" output_file="$input_file.enc" openssl enc -aes-256-cbc -salt -in "$i 阅读全文
posted @ 2024-04-17 17:56 Leonardo-li 阅读(93) 评论(0) 推荐(0) 编辑
摘要:[root@snort redis]# cat set.sh #!/bin/bash # Redis服务器地址和端口 REDIS_HOST="localhost" REDIS_PORT="6379" REDIS_PASS="123456" # 插入的键值对数量 NUM_ENTRIES=1000000 阅读全文
posted @ 2024-03-27 14:16 Leonardo-li 阅读(178) 评论(0) 推荐(0) 编辑
摘要:[ytx@work shell]$ cat ssl_check.sh #!/bin/bash # 设置要检查的域名和端口 DOMAIN="www.xxx.com" #域名 PORT=443 #端口 # 获取SSL证书信息 CERT_INFO=$(openssl s_client -connect $ 阅读全文
posted @ 2023-12-18 17:51 Leonardo-li 阅读(384) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash # 源文件夹和目标文件夹 source_dir="/path/to/source_folder" destination_dir="/path/to/destination_folder" # 指定要移动的文件数量 files_to_move=5000 # 使用find命令查 阅读全文
posted @ 2023-11-03 15:44 Leonardo-li 阅读(5) 评论(0) 推荐(0) 编辑
摘要:1.创建generate_password.sh脚本 2.编写内容 #!/bin/bash # 默认密码长度 length=12 # 默认包含大小写字母、数字和特殊字符 characters="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0 阅读全文
posted @ 2023-09-13 14:30 Leonardo-li 阅读(428) 评论(0) 推荐(0) 编辑
摘要:[root@harbor tools]# cat test.sh #!/bin/bash # 生成随机密码 password=$(openssl rand -base64 12) # 输出生成的密码 echo "生成的密码为: $password" 阅读全文
posted @ 2023-04-25 18:00 Leonardo-li 阅读(114) 评论(0) 推荐(0) 编辑
摘要:>/dev/null 2>&1 的含义: 将标准输出和错误输出全部重定向到/dev/null中,也就是将产生的所有信息丢弃。 详细分析下: 符号 > 等价于 1> (系统默认为1,省略了先); 所以">/dev/null"等同于 "1>/dev/null" /dev/null 表示空设备文件 0 表 阅读全文
posted @ 2023-04-07 17:46 Leonardo-li 阅读(153) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bashfunction get_json(){ echo "${1//\"/}" | sed "s/.*$2:\([^,}]*\).*/\1/" } function deal_json(){ cmd="curl -s http://127.0.0.1:28888/aibox/ser 阅读全文
posted @ 2022-12-07 16:03 Leonardo-li 阅读(2672) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash startTime=`date +%Y%m%d-%H:%M:%S` startTime_s=`date +%s` sleep 15 endTime=`date +%Y%m%d-%H:%M:%S` endTime_s=`date +%s` sumTime=$[ $endTime 阅读全文
posted @ 2022-10-17 15:34 Leonardo-li 阅读(358) 评论(0) 推荐(0) 编辑
摘要:1.封装函数 #!/bin/bash function log() { echo "$@" } //测试: log "this is a test..." log "today is `date '+%Y-%m-%d'` " 2.设置时间日志 #!/bin/bash function log() { 阅读全文
posted @ 2022-10-12 16:09 Leonardo-li 阅读(231) 评论(0) 推荐(0) 编辑
摘要:shell脚本ip校验 1 IP=$1 2 VALID_CHECK=$(echo $IP|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}') 3 echo $VALID_CHECK 4 5 if echo $IP|grep -E "^ 阅读全文
posted @ 2021-06-03 10:44 Leonardo-li 阅读(177) 评论(0) 推荐(0) 编辑
摘要:shell整数和小数,小数和小数之间的计算 #!/bin/bash a=5.01 b=5.1 if [ `expr $a \> $b` -eq 0 ];then echo $b is bigger else echo $a is bigger fi 阅读全文
posted @ 2021-04-27 09:43 Leonardo-li 阅读(253) 评论(0) 推荐(0) 编辑
摘要:1 #!/bin/bash 2 #Shell statistics.sh 3 #Author lipc 4 #Date 20200818 5 #Ps tomcat接入日志分析,需要tomcat日志开启访问时间记录 6 7 time1=$(date "+%Y-%m-%d %H:%M:%S") 8 ti 阅读全文
posted @ 2020-08-18 18:45 Leonardo-li 阅读(388) 评论(0) 推荐(0) 编辑
摘要:1 #!/bin/sh 2 #Shell menu.sh 3 #Author lipc 4 #Date 20200818 5 #Ps linux系统压测,有些工具需要下载,脚本不完善,需要调试 6 7 # Check if user is root 8 [ $(id -u) != "0" ] && 阅读全文
posted @ 2020-08-18 18:02 Leonardo-li 阅读(493) 评论(0) 推荐(0) 编辑
摘要:1 #!/bin/sh 2 # lazy find 3 4 # GNU All-Permissive License 5 # Copying and distribution of this file, with or without modification, 6 # are permitted 阅读全文
posted @ 2020-07-24 14:40 Leonardo-li 阅读(365) 评论(0) 推荐(0) 编辑
摘要:1 #!/bin/bash 2 3 #name: safe_check.sh 4 #Author: lipc 5 #Date: 2019-11-30 6 #Version: 1.0 7 #Notes: 此脚本用来做系统的安全巡检 8 9 read key 10 11 echo "警告:本脚本只是一个 阅读全文
posted @ 2019-12-28 17:38 Leonardo-li 阅读(1398) 评论(0) 推荐(0) 编辑
摘要:1 #!/bin/bash 2 LOCK_NAME="/tmp/my.lock" 3 if ( set -o noclobber; echo "$$" > "$LOCK_NAME") 2> /dev/null; 4 then 5 trap 'rm -f "$LOCK_NAME"; exit $?' 阅读全文
posted @ 2019-12-26 09:13 Leonardo-li 阅读(796) 评论(0) 推荐(0) 编辑
摘要:. #!/bin/bashread -p "请输入ip:" IPread -p "请输入掩码:" MASK #read -p "IP ADDRESS:" IPADDecho $IP > /tmp/tmpserveripecho $IP | grep "^[0-9]\{1,3\}\.[0-9]\{1, 阅读全文
posted @ 2018-02-11 09:51 Leonardo-li 阅读(459) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示