Moxa TC-6110-T-LX [53/117] A sample mxhtspd setup

Moxa TC-6110-T-LX [53/117] A sample mxhtspd setup
TC-6110 Linux User's Manual Managing Communications
3-35
# The default runlevel.
id:2:initdefault:
3. Enable rsyslogd at startup by editing the symlink located in the appropriate runlevel control directoriy
(here, we are using the default runlevel 2):
Moxa:/etc/rc2.d# mv N10rsyslog S10rsyslog
4. You may set syslog to report mxhtspd as a specialized facility level, but the POSIX standard suggests you
set it to be recognized as a daemon. To set the system logger (syslog) to report mxhtspd as a daemon,
set the
/etc/init.d/mxhtspd.sh script to set mxhstpd with facility level 3:
#Add parameter if necessary
mxhtspd -l 3&
ATTENTION
You may refer to the Wikipedia page for a good overview of the sy
slog system and facility and severity levels::
http://en.wikipedia.org/wiki/Syslog (Dec. 2013)
5. Edit the configuration file /etc/rsyslogd.conf.
#Uncomment below lines for mxhtspd with local 0
daemon.* -/var/log/mxhtspd.log
mxhtspd will now log messages as a daemon facility. The destination file is /var/log/mxhtspd.log. The
minus (-) sign indicates to omit synching the file after every logging.
6. Restart your computer to activate the settings.
ATTENTION
When you run rsyslogd daemon to log message
s at startup, take care to prevent excessive disk usage.
A Sample mxhtspd Setup
In this section we show an example that illustrates how to deploy mxhtspd. The program is named
log_application, and its purpose is to collect important data and save the data to the permanent storage
drive once daily. The following settings will illustrate how to identify that the drive is full, and how to start or
stop the application without using an external monitor.
1. Whenever a module’s X1 button (located on the spine of the module) is pressed for longer than 5 seconds,
the action_btn_pressed script corresponding to that module is called. By adding the following lines in the
appropriate action_btn_pressed, whenever button X1 is pressed longer than 5 seconds the
log_application program will be triggered.
#!/bin/sh
file=`basename $0`
num=$1
#Add your commands here
/home/log_application
echo “$file: Button $num is pressed”
2. Whenever a module’s X1 button is pressed for shorter than 5 seconds, the action_btn_short_pressed
script corresponding to that module is called. The script below sets the action for a short press to stop the
daemon so that the disk may be removed. In the action_btn_short_pressed file, you should kill the

Содержание

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

Скачать