starter: add initscript
This commit is contained in:
parent
93eadb18d6
commit
c88ae6b40c
@ -2,9 +2,20 @@ SUMMARY = "Tango Controls Starter"
|
||||
LICENSE = "GPL-3.0"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=1ebbd3e34237af26da5dc08a4e440464"
|
||||
|
||||
SRC_URI = "gitsm://gitlab.com/tango-controls/starter.git;protocol=https;branch=main"
|
||||
SRC_URI = " \
|
||||
gitsm://gitlab.com/tango-controls/starter.git;protocol=https;branch=main \
|
||||
file://tango-starter.sh \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
DEPENDS = "libtango omniorb"
|
||||
RDEPENDS:${PN} = "tango-admin"
|
||||
|
||||
inherit cmake pkgconfig
|
||||
INITSCRIPT_NAME = "tango-starter"
|
||||
INITSCRIPT_PARAMS = "defaults 70"
|
||||
|
||||
inherit cmake pkgconfig update-rc.d
|
||||
|
||||
do_install:append() {
|
||||
install -D -m 0755 ${WORKDIR}/tango-starter.sh ${D}${sysconfdir}/init.d/tango-starter
|
||||
}
|
||||
79
recipes-tools/starter/tango-starter/tango-starter.sh
Normal file
79
recipes-tools/starter/tango-starter/tango-starter.sh
Normal file
@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
. /etc/init.d/functions
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DAEMON=/usr/bin/Starter
|
||||
NAME=tango-starter
|
||||
DESC="Tango Control System Starter"
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
|
||||
USER=tango
|
||||
GROUP=tango
|
||||
INSTANCE=`hostname`
|
||||
|
||||
[ -x "$DAEMON" ] || { failure; echo " $DAEMON executable not found."; exit 1; }
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
check_database()
|
||||
{
|
||||
# Ping network seems to be broken (hangs forever)
|
||||
#tango_admin --ping-network 40 || return 1
|
||||
tango_admin --ping-database 6 || return 1
|
||||
}
|
||||
|
||||
check_and_register_instance()
|
||||
{
|
||||
tango_admin --check-device tango/admin/$INSTANCE || \
|
||||
tango_admin --add-server Starter/$INSTANCE Starter tango/admin/$INSTANCE || return 1
|
||||
}
|
||||
|
||||
do_start()
|
||||
{
|
||||
echo "Starting $DESC..."
|
||||
check_database
|
||||
[ "$?" -eq "1" ] && { failure; echo " Database ping failed."; exit 1; }
|
||||
passed; echo " Database ping OK."
|
||||
check_and_register_instance
|
||||
[ "$?" -eq "1" ] && { failure; echo " Could not register Starter instance $INSTANCE."; exit 1; }
|
||||
passed; echo " Starter instance OK.";
|
||||
start-stop-daemon -S -x $DAEMON -c $USER:$GROUP -p $PIDFILE -m -b -- $INSTANCE
|
||||
success; echo " $DESC started."
|
||||
}
|
||||
|
||||
do_stop()
|
||||
{
|
||||
echo "Stopping $DESC..."
|
||||
start-stop-daemon -K -x $DAEMON -p $PIDFILE
|
||||
success; echo " $DESC stopped."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
do_stop
|
||||
;;
|
||||
status)
|
||||
status $DAEMON
|
||||
;;
|
||||
reload)
|
||||
echo "Reloading $DESC..."
|
||||
start-stop-daemon -K -s 1 -x $DAEMON -p $PIDFILE
|
||||
success; echo " $DESC reloaded."
|
||||
;;
|
||||
restart|force-reload)
|
||||
echo "Restarting $DESC..."
|
||||
do_stop
|
||||
sleep 5
|
||||
do_start
|
||||
success; echo " $DESC restarted."
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
echo "Usage: $N {start|stop|status|reload|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Loading…
x
Reference in New Issue
Block a user