Moxa TC-6110-LX [115/117] A sample initialization script

Moxa TC-6110-LX [115/117] A sample initialization script
TC-6110 Linux User's Manual Sample Scripts & Firewall Rules
C-2
A Sample Initialization Script
#! /bin/sh
# Copyright (c) XXXX <<Your Name Here>>
# All rights reserved.
#
#
# /etc/init.d/<<name of your script here>>
# and its symbolic link
# /usr/sbin/rc<<name of your script here>>
### BEGIN INIT INFO
# Provides: <<name of your script here>>
# Required-Start: $network
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: The <<name of your script here>> daemon provides....
# Description: The <<name of your script here>> daemon is ...
# that is active in runlevels 3 and 5.
#
### END INIT INFO
# Check for missing binaries
<<NAME OF YOUR SCRIPT HERE>>_BIN=/usr/bin/<<name of your script here>>
test -x $<<NAME OF YOUR SCRIPT HERE>>_BIN || { echo "$<<NAME OF YOUR SCRIPT HERE>>
_BIN
not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
<<NAME OF YOUR SCRIPT HERE>>_CONFIG=/etc/<<name of your script here>>.cfg
test -r $<<NAME OF YOUR SCRIPT HERE>>_CONFIG || { echo "$<<NAME OF YOUR SCRIPT HERE>>
_CONFIG
not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
# Read config
. $<<NAME OF YOUR SCRIPT HERE>>_CONFIG
# Load the rc.status script for this service.
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting <<name of your script here>> "
## Start daemon with startproc(8). If this fails
## the return value is set appropriately by startproc.
startproc $<<NAME OF YOUR SCRIPT HERE>>_BIN
# Remember status and be verbose

Содержание

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

Скачать