Moxa V2616A-C5 [16/111] Changing run levels

Moxa V2616A-C7-T [16/111] Changing run levels
V2616A Linux Software Configuration
2-9
Changing Run-Levels
To assign a program to a run-level with an execution priority, following the instructions below.
Because the root file system is mounted in read-only mode, we need to re-mount it with write permission:
MOXA:~# mount -o remount,rw /
Edit a shell script to execute /root/tcps2-release and save it to tcps2 as an example.
MOXA:~# cd /etc/rc2.d
MOXA:~#ln –s /etc/root/tcps2 S60tcps2
or
MOXA:~#ln –s /etc/root/tcps2 k30tcps2
MOXA:~# cd /etc/rc2.d
MOXA:/etc/rc2.d#
MOXA:/etc/rc2.d# ls
S19nfs-common S25nfs-user-server S99showreadyled
S20snmpd S55ssh
S24pcmcia S99rmnologin
MOXA:/etc/rc2.d#
MOXA:/etc/rc2.d# ln –s /root/tcps2-release S60tcps2
MOXA:/etc/rc2.d# ls
S19nfs-common S25nfs-user-server S99rmnologin
S20snmpd S55ssh S99showreadyled
S24pcmcia S60tcps2
The command SxxRUNFILE has the following meaning:
S: Start the run file while Linux boots up.
xx: A number between 00 and 99. The smaller number has a higher priority.
RUNFILE: The script file name
The command KxxRUNFILE has the following meaning:
K: Start the run file while Linux shuts down or halts.
xx: A number between 00 and 99. The smaller number has a higher priority.
RUNFILE: The script file name
To remove the daemon, use the following command to remove the run file from /etc/rc2.d by:
MOXA:~# rm –f /etc/rc2.d/S60tcps2
After you finish writing or modifying the code, remember to remount the root directory in read-only mode. You
may do this with the following command
:
MOXA:~# umount /
Managing Services with insserv
Linux services can be started or stopped using the scripts in /etc/init.d/. If you want to start up some
service, you can use insserv to add or remove the service in the specific run level,
/etc/rcX.d/. You can
follow this tutorial to add or remove some service from the run levels. First, you should write a start-stop script
named tcps2 in
/etc/init.d/.
# !/bin/sh
### BEGIN INIT INFO
# Provides: tcps2
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6

Содержание

Похожие устройства

Скачать