GUF-Yocto-34.0-r5756-0
VINCELL
User Manual
start
stop
The command can be called by hand to start or stop a specific service. In order to start a service automatically
during system boot, a link to the script has to be created in the
/etc/rc.d
directory. See chapter
[
I
for the link creation procedure.
For your demo application, create a new script at
/etc/init.d/myapp
on the target system:
root@vincell:~# nano /etc/init.d/myapp
Change the contents of this file as follows:
#!/bin/sh
### BEGIN INIT INFO
# Provides:
myapp
# Required-Start:
$all <what ever my be needed>
# Required-Stop:
# Default-Start:
2 3 4 5
# Default-Stop:
0 1 6
# Short-Description: Start myapp at boot time
# Description:
### END INIT INFO
[ -f /etc/profile.d/tslib.sh ] && . /etc/profile.d/tslib.sh
[ -f /etc/profile.d/qt5-touch-config.sh ] && . /etc/profile.d/qt5-touch-config.sh
export DISPLAY=:0
case "$1" in
start)
# We don't want this script to block the rest of the boot process
if [ "$2" != "background" ]; then
$0 $1 background &
else
while [
-f /var/run/starting_xserver ]
do
sleep 1;
done
start-stop-daemon -m -p /var/run/myapp.pid -b -a /usr/bin/myapp -S
fi
;;
stop)
start-stop-daemon -p /var/run/myapp.pid -K
;;
*)
echo "Usage: /etc/init.d/myapp {start|stop}" >&2
exit 1
;;
esac
Save the changes by pressing
Ctrl+O
and accept the target file name as suggested by pressing
[RETURN]
.
Leave the nano editor by pressing
Ctrl+X
.
Make
/etc/init.d/myapp
executable:
root@vincell:~# chmod a+x /etc/init.d/myapp
Create startlinks in
/etc/rc*.d/
:
root@vincell:~# update-rc.d myapp defaults 95 5
If the Garz & Fricke demo application is installed on your device, its startlink should be deleted so that your
application is the only application automatically started:
43