linux下利用shell脚本自动添加计划任务 天边的云 5月前 shell linux下利用shell脚本自动添加计划任务 echo "/1 * bash /root/ab.sh" >> "/var/spool/cron/crontabs/root"利用root用户,创建一个计划任务,每分钟执行一次
linux下sed替换指定行的字符 天边的云 5月前 shell linux下sed替换指定行的字符 语法sed -i '行数s/内容/新内容/g' 文件替换46和47行的指定内容sed -i '46s#basedir=#basedir=/usr/local/mysql#g' /etc/init.d/mysqld sed -i '47s#datadir=#datadir=/home/mysql/data#g' /etc/init.d/mysqld
通过shell命令杀死某个正在运行的程序 天边的云 5月前 shell 通过shell命令杀死某个正在运行的程序 ps -ef | grep 程序名 | grep -v grep |awk '{print $2}' | xargs kill -9
shell获取文件夹下所有文件 天边的云 5月前 shell shell获取文件夹下所有文件 #!/bin/bash #需要展示的文件目录 mldir="/home/" mlfile=$(ls $mldir) for filelb in ${mlfile} do echo "${filelb}" done
curl返回200代码 天边的云 5月前 shell curl返回200代码 url="https://www.loshub.com"curl --insecure -I -m 30 -o /dev/null -s -w %{http_code}"\n" $url
最近评论