Script de controle do Alfresco para RHEL / CentOS / Fedora
Publicado por Davidson Rodrigues Paulo (última atualização em 21/09/2009)
[ Hits: 8.518 ]
Homepage: http://davidsonpaulo.com/
Script de controle do Alfresco para ser usado no RHEL, CentOS e Fedora. Pode ser usado para iniciar, reiniciar e verificar o status do processo Alfresco.
O script considera que o Alfresco está instalado em /opt/alfresco.
Salve o arquivo em /etc/init.d/alfresco e execute o comando:
# chkconfig --add alfresco
e então você poderá gerenciar o serviço do Alfresco da mesma forma que os demais serviços que ficam /etc/init.d.
#!/bin/bash # # alfresco This shell script takes care of starting and stopping # the Alfresco Enterprise Content Management system # # Author: Davidson Paulo <davidsonpaulo@gmail.com> # License: GNU GPL v3+ # # chkconfig: 345 99 00 # description: Alfresco ECM # processname: alfresco # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network user="alfresco" prog="Alfresco" pidfile="/var/run/${prog}.pid" testport() { telnet -e B localhost 8080 > /dev/null 2>&1 << EOF B quit EOF return $? } testsite() { wget --timeout=10 --tries=30 -O - http://127.0.0.1:8080/alfresco > /dev/null 2>&1 return $? } start(){ echo -n $"Starting $prog: " su - $user -c "./alf_start.sh" > /dev/null 2>&1 sleep 3 if ! testport ; then failure ; echo return 1 else pid="$( netstat -ltnp | fgrep ":8080" | awk '{ print $7 }' | cut -d/ -f1 )" success ; echo echo $pid > $pidfile prog="Alfresco Web Framework" echo -n $"Starting $prog: " if ! testsite ; then failure ; echo else success ; echo fi fi } stop(){ if [ -f $pidfile ] ; then pid="$( cat $pidfile )" else pid="$( netstat -ltnp | fgrep ":8080" | awk '{ print $7 }' | cut -d/ -f1 )" fi echo -n $"Stopping $prog: " su - $user -c "./alf_stop.sh" > /dev/null 2>&1 if ! testsite && ! testport ; then for i in $( seq 1 10 ) ; do if [ -n "$( ps ax | awk '$1 == '$pid' { print $1 }' )" ] ; then kill $pid sleep 1 else success ; echo rm -f $pidfile return 0 fi done failure ; echo else failure ; echo fi } restart(){ stop start } status(){ base="$prog" if [ -f $pidfile ] ; then pid="$( netstat -ltnp | awk '$4 ~ /^.*:8080$/ && $7 ~ /'$( cat $pidfile )'\/java/ { print $7 }' | cut -d/ -f1 )" else pid="$( netstat -ltnp | awk '$4 ~ /^.*:8080$/ { print $7 }' | cut -d/ -f1 )" fi if [ -n "$pid" ] ; then echo $"${base} (pid $pid) is running..." else echo $"${base} is stopped" fi ports="$( netstat -lnp | fgrep $pid/java | awk '{ print $4 }' | rev | cut -d: -f1 | rev )" cifsports=( 139/tcp 445/tcp 137/udp ) vtiport="7070/tcp" # Check CIFS status base="$prog CIFS server" CIFS="" c=0 for (( i=0 ; i<${#cifsports[@]} ; i++ )) ; do port=${cifsports[$i]} proto=${port#*/} number=${port%/*} frwrule="$( iptables-save | fgrep REDIRECT | fgrep -- "-p $proto" | fgrep -- "--dport $number " )" if [ -n "$frwrule" ] ; then dport=$( echo "$frwrule" | sed -r 's/.*--to-ports ([^ ]*)/\1/' ) else dport=$number fi while read line ; do if [ $line -eq $dport ] ; then lport=$line break else lport="" fi done < <( netstat -lnp | awk '$1 == "'$proto'" { print $4 }' | rev | cut -d: -f1 | rev ) if [ -n "$lport" ] ; then CIFS[$c]="$lport" (( c++ )) fi done if [ ${#CIFS[@]} -gt 0 ] ; then if [ ${#CIFS[@]} -eq ${#cifsports[@]} ] ; then echo $"${base} (pid $pid) is running..." else echo $"${base} is stopped" fi else echo $"${base} is stopped" fi # Check VTI status base="$prog VTI server" proto=${vtiport#*/} number=${vtiport%/*} while read line ; do if [ $line -eq $number ] ; then lport=$line break else lport="" fi done < <( netstat -lnp | awk '$1 == "'$proto'" { print $4 }' | rev | cut -d: -f1 | rev ) if [ -n "$lport" ] ; then echo $"${base} (pid $pid) is running..." else echo $"${base} is stopped" fi } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart|status}" exit 1 esac exit $?
facilitando e organizando a configuracao do mrtg com ipfm
Manutenção básica em partições Windows
Baixa os pacotes de uma determinada versão do Slackware para posterior atualizaçao
Atualizando páginas automaticamente com Lynx
Nenhum comentário foi encontrado.
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
Solução rápida para o problema do Network Manager conectar mas não navegar
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
Tecla shifit parou de funcionar (1)
estou com um erro no pacman (9)