2019-07-09 19:26:40 +02:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: tokenbridge-monitor
|
|
|
|
# Required-Start: $remote_fs $syslog
|
|
|
|
# Required-Stop: $remote_fs $syslog
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
# Short-Description: Start daemon at boot time
|
|
|
|
# Description: Enable service provided by daemon.
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
WORKDIR="{{ '/home/' + compose_service_user | default('poadocker') + '/' + bridge_path + '/monitor' if bridge_path[:1] != "/" else bridge_path + '/monitor' }}"
|
|
|
|
|
|
|
|
start(){
|
|
|
|
echo "Starting TokenBridge Monitor.."
|
|
|
|
cd $WORKDIR
|
|
|
|
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v
|
|
|
|
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose rm -fv
|
|
|
|
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose up --detach
|
2020-01-10 09:55:35 -03:00
|
|
|
sudo -u "{{ compose_service_user }}" /bin/bash -c 'cd scripts; ./getBridgeStats.sh >cronWorker.out 2>cronWorker.err'
|
2019-07-09 19:26:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
stop(){
|
|
|
|
echo "Stopping TokenBridge Monitor.."
|
|
|
|
cd $WORKDIR
|
|
|
|
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v
|
|
|
|
sleep 2
|
|
|
|
}
|
|
|
|
|
|
|
|
status(){
|
|
|
|
echo "TokenBridge Monitor status:"
|
|
|
|
cd $WORKDIR
|
|
|
|
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose ps
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
|
|
|
|
status)
|
|
|
|
status
|
|
|
|
;;
|
|
|
|
|
|
|
|
restart)
|
|
|
|
echo "Restarting TokenBridge Monitor.."
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2020-02-04 02:16:27 -03:00
|
|
|
echo $"Usage: $0 {start|stop|restart|status}"
|
2019-07-09 19:26:40 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|