在升级时禁用MongoDB重启(RPM包)
MongoDB RPM包(由官方repo.MongoDB.org存储库提供,自版本3.4.1起)在包升级时自动无条件重启服务器。此行为硬编码到Poston处理程序中:在升级时禁用MongoDB重启(RPM包),mongodb,rpm,yum,Mongodb,Rpm,Yum,MongoDB RPM包(由官方repo.MongoDB.org存储库提供,自版本3.4.1起)在包升级时自动无条件重启服务器。此行为硬编码到Poston处理程序中: if test $1 -ge 1
if test $1 -ge 1
then
/usr/bin/systemctl restart mongod >/dev/null 2>&1 || :
fi
这是一种不方便且危险的行为,尤其是在使用配置管理工具设置服务器时。例如,我想先运行一个完整的Ansible playbook来设置我的服务器,然后逐个手动重新启动MongoDB以完全控制情况
有没有办法改变或禁用此功能?可能是其他MongoDB软件包?或者使用一些模糊的yum/rpm命令选项来禁用scriptlet
我知道我可以切换到simple.tar.gz安装,但这是最后的选择。如果您首先下载rpm并使用
rpm
手动安装;您可以使用--nopostun
选项:
rpm -Uvh mongodb***rpm --nopostun
从rpm手册页:
afaik
yum
无法处理--nopostun
和其他标志。我目前正在研究yum-plugin-tsflags,它大概可以处理这个问题。是的,这可能会对您有所帮助;但是要小心;如果您运行yum升级--nopostun
(假设yum能够理解);他可能会为他将要安装的所有RPM禁用所有Poston脚本…yum plugin tsflags对我的作用如下:yum-y--setopt=tsflags=noscripts install mongodb org
--noscripts
--nopre
--nopost
--nopreun
--nopostun
--nopretrans
--noposttrans
Don't execute the scriptlet of the same name. The --noscripts option is equivalent to
--nopre --nopost --nopreun --nopostun --nopretrans --oposttrans
and turns off the execution of the corresponding %pre, %post, %preun, %postun %pretrans, and %posttrans scriptlet(s).