Skip to content

Instantly share code, notes, and snippets.

@vmassuchetto
Last active June 10, 2018 14:18
Show Gist options
  • Save vmassuchetto/d43886fa0726feb73b73 to your computer and use it in GitHub Desktop.
Save vmassuchetto/d43886fa0726feb73b73 to your computer and use it in GitHub Desktop.
Initscript para o Totvs Microsiga Protheus: License server, cTree, DBAccess, Appserver e Workflow
#!/bin/bash
### BEGIN INIT INFO
# Provides: protheus
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/stop protheus server
### END INIT INFO
#
# Você está utilizando um script livre. =)
# ----------------------------------------
#
# Copyright (C) Vinicius Massuchetto
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# Sobre o script
# --------------
#
# Initscript para Debian/Ubuntu do Totvs Microsiga Protheus: Appserver,
# DBAccess, cTree e Workflow de compras.
#
# Utiliza um arquivo de variáveis e funções de ambiente disponível em:
# https://gist.github.com/vmassuchetto/4252befa6456af25a775
#
# Como somente as variáveis de sistema estão disponíveis durante o boot,
# deve-se copiar os procedimentos abaixo em outro arquivo caso a instalação
# tenha diferentes ambientes como teste e homologação.
#
# Arquitetura
#
# * Appserver (1 master, 4 slaves)
# * DBAccess (1 aplicação, 1 tss)
# * cTree (1 aplicação)
# * TSS (1 aplicação)
# * Workflow (1 aplicação)
#
# Arquivos
#
# * aplicações /root/totvs/<aplicacao>/<ambiente>/
# * logs /var/log/protheus/<ambiente>-<aplicacao>.log
#
# Inicialização
#
# /etc/init.d/protheus {start|stop|restart|status}
# service protheus {start|stop|restart|status}
#
# Configuração para inicialização durante o boot
#
# update-rc protheus defaults
#
#
# Ambiente
#
export PROTHEUS_ENV="producao"
[ -f /etc/init.d/protheus_env ] && . /etc/init.d/protheus_env
#
# Execução
#
if [ "$(whoami)" != "root" ] ; then
echo "Erro: usuário sem permissão."
exit 1
fi
if contains "start stop restart status" $1 ; then
echo -e "Ambiente\t\t\t$PROTHEUS_ENV"
echo -e "Ação\t\t\t\t$1"
else
echo "Erro: parâmetro de ação incorreto: $1"
show_usage
exit 1
fi
case $1 in
start )
start
;;
stop )
stop
;;
restart )
stop
start
;;
status )
status
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment