0
我已经创建了一个bash脚本,它通过一个crontab运行,该脚本检查linux主机上安装的nmap版本。问题是,由于某种原因,检查工作不正常,它总是试图一次又一次地安装NMAP ...检查程序的版本,所以在bash中的东西
#!/bin/sh
if ! $(nmap --version | grep -q "7.12"); then
wget https://nmap.org/dist/nmap-7.12.tar.bz2 -P /tmp/
cd /tmp && bzip2 -cd nmap-7.12.tar.bz2 | tar xvf -
cd nmap-7.12
./configure --without-zenmap
make
make install
cd ..
rm nmap-7.12.tar.bz2
rm -rf nmap-7.12
reboot
fi
如果我检查,看看是否作业运行(这是它应该一次,但从来没有一次因为版本应与第二次)这是...
$> ps aux | grep nmap
root 27696 15.4 0.3 2940 1464 ? R 16:31 0:00 /bin/bash ./configure --disable-option-checking --prefix=/usr/local --without-zenmap --cache-file=/dev/null --srcdir=. --no-create --no-recursion
运行命令行收益率检查(无-q):
$> nmap --version | grep "7.12"
Nmap version 7.12 (https://nmap.org)
什么是搞砸了我的脚本PT?