简体   繁体   English

如何在初始化脚本中设置顺序?

[英]How to set order in init scripts?

I create some /etc/init scripts, but one script (script B) depend on other (script A). 我创建了一些/ etc / init脚本,但是一个脚本(脚本B)依赖于另一个(脚本A)。 How to order execution of those scripts? 如何命令执行这些脚本? I want to system first execute script A, and then script B. Process that start script B will be killed and execute again couple of times during one day, and I want to script A execute only on reboot not every time before script B. How to do that? 我要系统先执行脚本A,然后执行脚本B。启动脚本B的进程将被终止,并在一天之内再次执行两次。我想让脚本A仅在重新启动时才执行,而不是每次在脚本B之前都执行。要做到这一点?

You have a couple of options: 您有两种选择:

  1. Put script A outside /etc/init and make a call to it in the very beginning of script B . script A放在/etc/init之外,并在script B开始处对其进行调用。
  2. Put script B outside /etc/init and make a call to it in the very end of script A script B放在/etc/init之外,并在script A末尾对其进行调用

EDIT 编辑

If the calling sequence is always A; B 如果呼叫顺序始终为A; B A; B for B , but A runs independently only on reboot, you have another option: A; B代表B ,但是A仅在重新启动时独立运行,您还有另一个选择:

  1. Put script B outside /etc/init since it does not belong there and call /etc/init/A from the beginning of it. script B放在/etc/init因为它不属于/etc/init/A从其开头调用/etc/init/A

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 zsh 中创建可以接受乱序参数的脚本? - How to create scripts in zsh that can accept out of order arguments? 如何使用 powershell 脚本将 makefile 变量(CC、CFLAGS 等)设置为终端或 cmd? - How can I set makefile variables (CC, CFLAGS etc) to terminal or cmd using powershell scripts? 如何将 2 个脚本组合在一起? - How to combine 2 scripts together? 在 C# 项目中运行一组脚本 - Have a set of scripts run in C# Projects 如何在 Windows 中执行 Python 脚本? - How to execute Python scripts in Windows? python脚本如何工作? - How do python scripts work? 如何将脚本放入标题模板? - How put scripts into header template? 为了将鼠标光标设置在该位置,如何识别网页中找到的文本的屏幕位置? - How to identify the screen position of found text in a web page, in order to set the mouse cursor to that position? 我可以制作一组Google文档来“继承”存储在其他位置的脚本吗? - Can I make a set of Google Documents to “inherit” scripts stored elsewhere? 可以通过 Windows 登录脚本设置系统环境变量吗? - Can system Environment Variables be set via Windows Logon Scripts?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM