我需要在bash脚本中自动安装NRPE代理。如何在远程目录中“make; make install”?这是迄今为止的代码:
#!/bin/bash
for f in *.tar.gz
do
tar zxf "$f" -C /home/$USER/
done
sudo useradd -s /sbin/nologin -M nagios
/home/$USER/nagios-plugins-2.2.1/configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib64/
因此,在“configure”部分结束后,我需要执行“make; make install”。另外,有没有办法优化当前脚本?
这可能有助于Khanna111's hint:
cd /home/$USER/nagios-plugins-2.2.1 || exit 1
configure <options> && make && sudo make install