Step-by-Step Guide to your own Linux Application
•
109
Automatic start of new Programs (inittab/startwago)
WAGO-I/O-SYSTEM 750
Linux Fieldbus Coupler
inittab
calls the startwago script.
startwago
includes further program calls.
Since this file is a shell script, it is also possible to use conditional queries and
other shell commands. The
startwago
file on the Linux fieldbus coupler looks
as follows:
#!/bin/msh
# change setuid/setgid-Bit for tinylogin(su)
chmod +s /bin/tinylogin
# start the KBus-Driver
insmod kbus
# start modbus tcp server
/bin/mb_tcp &
# start web server (BOA)
boa -c /etc/boa &
# if it is configured, start the IOCheck-Driver /-Application
if grep -q "wago_console=yes" /proc/cmdline
then
rm /etc/inittab
ln -s /etc/wago_console/inittab.nottys0 /etc/inittab
insmod iocheck
else
rm /etc/inittab
ln -s /etc/wago_console/inittab.ttys0 /etc/inittab
/bin/iocheck &
insmod iocheck
fi
exit 0
During the start-up of the Linux fieldbus coupler, different programs are
started or file attributes are changed. For example, the BOA web server and
the Modbus program mb_tcp are started.