Skip to content
Snippets Groups Projects
Commit 148d6c39 authored by BRONES Romain's avatar BRONES Romain
Browse files

feat(opcua):Add init.d startup script

parent dca0a4fc
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
. /etc/init.d/functions
LOG_FILE=/var/log/fofb-opcua-server.log
LOCK_FILE=/var/lock/subsys/fofb-opcua-server.log
# Start the service
start() {
if [ -f $LOCK_FILE ]; then
echo "fofb-opcua server already running"
exit 1
fi
echo "Starting fofb-opcua-server" >> $LOG_FILE
cd /opt/fofb-opcua-server
stdbuf -oL opcua-generic-chimeratk-server01 &>> $LOG_FILE &
### Create the lock file ###
touch $LOCK_FILE
success $"fofb-opcua server startup"
}
# Restart the service
stop() {
echo "Stopping fofb-opcua-server" >> $LOG_FILE
killproc opcua-generic-chimeratk-server01
### Now, delete the lock file ###
rm -f $LOCK_FILE
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status opcua-generic-chimeratk-server01
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
......@@ -3,14 +3,22 @@ SECTION = "opt"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
# This will add startup scripts
INITSCRIPT_NAME = "fofb-opcua-server.sh"
INITSCRIPT_PARAMS = "defaults 91"
inherit update-rc.d
SRC_URI = " file://app.mapt \
file://devices.dmap \
file://generic_chimeratk_server_configuration.xml \
file://fofb-opcua-server.sh \
"
RDEPENDS_${PN}=" genericdeviceserver-opcua"
RDEPENDS_${PN}=" genericdeviceserver-opcua bash"
FILES_${PN}+="/opt/fofb-opcua-server/*"
FILES_${PN}+="/etc/init.d/fofb-opcua-server.sh"
do_compile() {
# Replace BAR by 0
......@@ -22,4 +30,7 @@ do_install() {
install -m 0644 ${WORKDIR}/app_bar0.mapt ${D}/opt/fofb-opcua-server/app.mapt
install -m 0644 ${WORKDIR}/devices.dmap ${D}/opt/fofb-opcua-server/devices.dmap
install -m 0644 ${WORKDIR}/generic_chimeratk_server_configuration.xml ${D}/opt/fofb-opcua-server/generic_chimeratk_server_configuration.xml
install -d ${D}/etc/init.d/
install -m 0755 ${WORKDIR}/fofb-opcua-server.sh ${D}/etc/init.d/fofb-opcua-server.sh
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment