⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 runlevel.mk

📁 This file is the compressed file of the run level script
💻 MK
字号:
######################################################################### Description : Gnu Makefile to control the services in the specified#               runlevel. It will run the required services, and log#               the output of the services to the file#               /var/log/initd.start (for service startup) and#               /var/log/initd.stop (for service shutdown).##               This controlling program is designed to be invoked by#               the "/etc/rc.d/rc" script.## Author      : jameshunt@uk.ibm.com## Notes       :## - Run as,##    make [-n] -j -f runlevel.mk \#        RUNLEVEL={0|1|2|3|4|5|6} \#        JOB={start|stop|restart|status}## - $(JOB) is not validated - that is left to the service program.# - $(RUNLEVEL) is not validated - that is left to the calling program#   (usually /etc/rc.d/rc).# - It wouldn't take too much effort to auto-generate this Makefile.########################################################################## passed as a parameterRUNLEVEL =# passed as a parameter (start, stop, status, etc)JOB =# set to a value to enable debug outputDEBUG =######################################################################### START CONFIGURATION# system commands used by this facilityCAT               = /bin/catRM                = /bin/rmECHO              = /bin/echoDATE              = /bin/date# Directory containing scripts/programs to run.INITD_DIR        := /etc/init.d# Directory into which a lock file is created when a service starts.# (Note that the lock file is created by the service).SUBSYS_FILE_DIR  := /var/lock/subsys# Used to create temporary files, before collating them all into # $(FINAL_OUTPUT_FILE).TMP_DIR          := /tmpTMPFILE_PREFIX   := .runlevelTMP_FILE          = $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).$@# File that contains all output of programs/scripts run.FINAL_OUTPUT_FILE = /var/log/initd.$(JOB)# List of *all* services.## (Important Note: if you don't include a service in this list,# it won't get run!)ALL               = \                    anacron       \                    apmd          \                    atd           \                    autofs        \                    crond         \                    gpm           \                    iptables      \                    isdn          \                    keytable      \                    kudzu         \                    local         \                    lpd           \                    netfs         \                    network       \                    nfslock       \                    ntpd          \                    pcmcia        \                    portmap       \                    postfix       \                    random        \                    rawdevices    \                    rhnsd         \                    sshd          \                    syslog        \                    xfs           \                    xinetd# END CONFIGURATION######################################################################### Check command-line parametersifndef RUNLEVEL$(error must specify RUNLEVEL, so I know what to run)endififndef JOB$(error must specify JOB, so I know what to do)endifdefault: $(ALL) create_final_output_fileifneq ($(DEBUG),)	@$(ECHO) "RUNLEVEL=$(RUNLEVEL)"	@$(ECHO) "JOB=$(JOB)"	@$(ECHO) "FINAL_OUTPUT_FILE=$(FINAL_OUTPUT_FILE)"	@$(ECHO) "TMP_FILE=$(TMP_FILE)"	@$(ECHO) "ALL=|$(ALL)|"	@$(ECHO)	@$(ECHO) "ALL (less local)=|$(filter-out local,$(ALL))|"	@$(ECHO)	@$(ECHO) "ALL (less kudzu)=|$(filter-out kudzu,$(ALL))|"	@$(ECHO)endif############################################################### Generic rule to control a service.## Note that we capture all output to a file.$(ALL)			: $(SUBSYS_FILE_DIR)/$@							@$(ECHO) "Begin \"$(JOB) $@\" at `$(DATE)`"  >  $(TMP_FILE)							@$(INITD_DIR)/$@ $(JOB)                      >> $(TMP_FILE) 2>&1							@$(ECHO) "End \"$(JOB) $@\" at `$(DATE)`"    >> $(TMP_FILE)############################################################### List of services that have dependencies.## (Note: It is not necessary to list services that have no# dependencies).# Include the relevant dependencies. If you intend to use this facility,# you must provide 2 makefiles / runlevel, one for starting the services# in the runlevel, and one for stopping the services in the runlevel.## WARNING: If make attempts to include a file that does not exist, it will# exit. This could cause your system to boot in an unfamiliar way.include $(JOB)$(RUNLEVEL).mk# Lastly, merge all the service output files into a single file.# Note that the order of the service output in the merged file is not# chronological.create_final_output_file	:														$(CAT) $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).* \																> $(FINAL_OUTPUT_FILE)														$(RM) -f $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).*# EOF

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -