从运行级别3切换到0时如何运行脚本

时间:2015-11-19 09:05:08

标签: linux centos runlevel

我需要在服务器进行关闭时运行脚本,即运行级别0.但是这里的问题是,我需要在脚本中进行curl调用,这在运行级别0是不可能的,因为网络将沮丧

所以我的问题是如何实现这一目标?

基本上我正在寻找的是当系统从运行级别3运行到运行级别0时运行脚本的解决方案。

感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

你可以将所有这些结合在一起

  • 使用10:41:59,972 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221001: HornetQ Server version 2.4.7.Final (2.4.7.Final, 12 4) [34da3fdf-8dba-11e5-9213-51bb5b0e6fe5] 10:42:00,399 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 64) WFLYMSG0002: Bound messaging object to jndi name java:jboss/ex ported/jms/RemoteConnectionFactory 10:42:00,459 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 68) HQ221003: trying to deploy queue jms.queue.DLQ 10:42:00,471 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 69) WFLYMSG0002: Bound messaging object to jndi name java:/Connect ionFactory 10:42:00,472 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 67) HQ221003: trying to deploy queue jms.queue.Events 10:42:00,476 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 66) HQ221003: trying to deploy queue jms.queue.ExpiryQueue 10:42:00,550 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) WFLYJCA0007: Registered connection factory java:/JmsXA 10:42:00,633 INFO [org.hornetq.ra] (MSC service thread 1-3) HornetQ resource adaptor started 10:42:00,642 INFO [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-3) IJ020002: Deployed: file://RaActivatorhornetq-ra 10:42:00,647 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) WFLYJCA0002: Bound JCA ConnectionFactory [java:/JmsXA] 10:42:00,648 INFO [org.jboss.as.messaging] (MSC service thread 1-3) WFLYMSG0002: Bound messaging object to jndi name java:jboss/DefaultJMSC onnectionFactory $ runlevel
  • 检查当前的运行级别
  • $ who -r中创建一个可执行脚本,检查当前的运行级别是否为/etc/init.d/ 并执行您想要的操作。
  • 3中创建一个带符号链接的符号链接。
  • 为了在禁用网络服务之前运行,符号链接的名称必须满足某些条件,请检查它们here。当然这取决于您的主机,并且将特定于您的配置。

这就是它,这应该有效!