English 中文(简体)
为什么在更新RPM之后停止服务
原标题:Why does service stop after RPM is updated
  • 时间:2012-01-13 17:45:25
  •  标签:
  • redhat
  • rpm

我有一套软件包,我为此创建了一个管道。 由于知识产权的原因,我可以在此 past开整个管道,但这里是问题的根源:

%pre
/sbin/pidof program
if [ "$?" -eq "0" ]
then
  /sbin/service program stop
fi

%post
/sbin/chkconfig program on
/sbin/service program start

%preun
/sbin/service program stop
/sbin/chkconfig program off

%postun
rm -rf /program_folder

Everytime I try to upgrade the package, it stops the program service, installs everything, starts the service, and then stops it again and deletes the folder...any ideas?

最佳回答

这与打字顺序有关:

%pre of new package
(package install)
%post of new package
%preun of old package
(removal of old package)
%postun of old package

因此,就你而言,旧胎体的<代码>%preun为时断,停用。

可以通过把这一论点看上来加以解决。 下表列出价值:

          install    upgrade  uninstall
%pre      $1 == 1   $1 == 2   (N/A)
%post     $1 == 1   $1 == 2   (N/A)
%preun    (N/A)     $1 == 1   $1 == 0
%postun   (N/A)     $1 == 1   $1 == 0

So, you d want your %postun script to instead be this:

%preun
if [ "$1" = "0" ]; then
    /sbin/service program stop
    /sbin/chkconfig program off
fi
exit 0

这样做只会使该方案完全停止(例如:rpm -e),并应当由您来实施。

<>strong>NOTE:请与<>%postun相同。 说明

<>strong>NOTE:exit 0 at the end;我谨具体指出,如果情况如此,由于最后指挥部的错误撤离代码将结转并导致该字母脱离这一状态,则造成碎块安装问题。

<>strong>NOTE: 固定在目前安装的碎块中的新平板。 页: 1 旧的纸浆和破碎的纸张,你将 fine。

这仅涵盖前/后印章;一份带有触发器的更详细版本,可在

问题回答

暂无回答




相关问题
Redhat AS 4 seg fault calling magic_buffer using Java 1.6

I have a java class that calls a C++ class via a JNI C++ class to access the file command functionality provided by libmagic.so. The C++ class compiles and run fine as a C++ main() -It works fine ...

How do I get gcc-3.2.2 on RHEL 5?

We just had our hosting provider build out a new RHEL 5 box for us to test some legacy stuff on: uname -a: Linux myserver.foo.com 2.6.18-164.9.1.el5 #1 SMP Wed Dec 9 03:29:54 EST 2009 i686 i686 i386 ...

Python Module To Detect Linux Distro Version

Is there an existing python module that can be used to detect which distro of Linux and which version of the distro is currently installed. For example: RedHat Enterprise 5 Fedora 11 Suse Enterprise ...

Linux Mysql Memory requirements

I have: 32 bit - Red Hat Enterprise Linux Server release 5.1 (Tikanga) Mysql 5 10G RAM What are the memory allocation limits with respect to mysql? Maximum memory usage possible. Any supporting ...

Troubles with errno.h

I m working with Rad Hat 8.0, trying to make changes to the kernel, and I m at the compilation stage. I have a header in include/linux where I define wrapper functions, and they use errno. I included ...

热门标签