1 Star 0 Fork 10

suanmb/plugin_linux_base

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
remove_crontab.sh 808 Bytes
一键复制 编辑 原始数据 按行查看 历史
xrkmonitor 提交于 2021-05-29 11:37 +08:00 . up
#!/bin/bash
script_path=''
script_name=''
function in_script_path()
{
echo "/" > _tmp
fc=`expr substr "$0" 1 1`
echo "$fc" > _tmp_2
cmp _tmp _tmp_2 > /dev/null 2>&1
if [ $? -eq 0 ];then
cscript=$0
else
cscript=$(pwd)/$0
fi
rm -f _tmp _tmp_2
script_path=`dirname $cscript`
script_name=`basename $cscript`
cd "$script_path"
}
in_script_path
crontab -l > _tmp
grep "${script_path}; \./cron_linux_base\.sh" _tmp > /dev/null 2>&1
if [ ! $? -eq 0 ]; then
rm _tmp
echo "already remove"
exit 0
fi
nline=`grep -n "${script_path}; \./cron_linux_base\.sh" _tmp |awk -F ":" '{print $1}'`
sed -i "${nline}d" _tmp
crontab _tmp
if [ $? -eq 0 ];then
rm _tmp
echo "remove crontab ok"
exit 0
fi
rm _tmp
echo "remove crontab failed"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/baoxx/plugin_linux_base.git
git@gitee.com:baoxx/plugin_linux_base.git
baoxx
plugin_linux_base
plugin_linux_base
master

搜索帮助