diff options
author | ramon <ramongomez@us.es> | 2014-03-21 13:11:50 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2014-03-21 13:11:50 +0000 |
commit | a36fbae6a7361df91db461a64c5a3a170a0ceba8 (patch) | |
tree | 89bcbbc005416b7982e1aaffdd6e1590258043d5 | |
parent | e1ddc835d45d35d30a66f1d89fa0ce7cf8df9e78 (diff) |
#621: Mejor detección del porcentaje de uso de CPU para evitar cuelgues del servidor.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4201 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-x | installer/opengnsys_installer.sh | 4 | ||||
-rwxr-xr-x | installer/opengnsys_update.sh | 4 | ||||
-rwxr-xr-x | repoman/bin/opengnsys.cron | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 031a4d37..ed77c3aa 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -140,7 +140,7 @@ OSCODENAME=$(lsb_release -cs 2>/dev/null) # Configuración según la distribución GNU/Linux. case "$OSDISTRIB" in Ubuntu|Debian|LinuxMint) - DEPENDENCIES=( subversion apache2 php5 php5-ldap libapache2-mod-php5 mysql-server php5-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa syslinux xinetd build-essential g++-multilib libmysqlclient15-dev wget doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools ) + DEPENDENCIES=( subversion apache2 php5 php5-ldap libapache2-mod-php5 mysql-server php5-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa syslinux xinetd build-essential g++-multilib libmysqlclient15-dev wget doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools top ) UPDATEPKGLIST="apt-get update" INSTALLPKG="apt-get -y install --force-yes" CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install" @@ -176,7 +176,7 @@ case "$OSDISTRIB" in TFTPCFGDIR=/var/lib/tftpboot ;; Fedora|CentOS) - DEPENDENCIES=( subversion httpd mod_ssl php php-ldap mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp syslinux xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++ libstdc++.i686 libstdc++-static.i686 libstdc++-devel.i686 make wget doxygen graphviz ctorrent samba rsync unzip debootstrap schroot squashfs-tools btrfs-progs ) + DEPENDENCIES=( subversion httpd mod_ssl php php-ldap mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp syslinux xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++ libstdc++.i686 libstdc++-static.i686 libstdc++-devel.i686 make wget doxygen graphviz ctorrent samba rsync unzip debootstrap schroot squashfs-tools btrfs-progs top ) INSTALLEXTRADEPS=( 'rpm -Uv ftp://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/files/i586/RPMS/netpipes-4.2-alt1.i586.rpm' 'pushd /tmp; wget http://download.bittornado.com/download/BitTornado-0.3.18.tar.gz; tar xvzf BitTornado-0.3.18.tar.gz; cd BitTornado-CVS; python setup.py install; ln -fs btlaunchmany.py /usr/bin/btlaunchmany; ln -fs bttrack.py /usr/bin/bttrack; popd' ) if [ "$OSDISTRIB" == "CentOS" ]; then diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index e68e23df..05f2a9e8 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -97,7 +97,7 @@ OSDISTRIB=$(lsb_release -is 2>/dev/null) # Configuración según la distribución de Linux. case "$OSDISTRIB" in Ubuntu|Debian|LinuxMint) - DEPENDENCIES=( php5-ldap xinetd rsync btrfs-tools ) + DEPENDENCIES=( php5-ldap xinetd rsync btrfs-tools top ) UPDATEPKGLIST="apt-get update" INSTALLPKGS="apt-get -y install --force-yes" CHECKPKG="dpkg -s \$package 2>/dev/null | grep -q \"Status: install ok\"" @@ -111,7 +111,7 @@ case "$OSDISTRIB" in APACHEGROUP="www-data" ;; Fedora|CentOS) - DEPENDENCIES=( php-ldap xinetd rsync btrfs-progs ) + DEPENDENCIES=( php-ldap xinetd rsync btrfs-progs top ) INSTALLPKGS="yum install -y" CHECKPKG="rpm -q --quiet \$package" if which systemctl &>/dev/null; then diff --git a/repoman/bin/opengnsys.cron b/repoman/bin/opengnsys.cron index 3e704579..4584aef7 100755 --- a/repoman/bin/opengnsys.cron +++ b/repoman/bin/opengnsys.cron @@ -17,20 +17,20 @@ typeset -i OGCPU # % uso CPU if [ "$RUN_OGADMSERVER" == "yes" ]; then # Parar procesos ogAdmServer si consume más de 90% de CPU. OGPID=$(pgrep ogAdmServer) - OGCPU=$(printf "%d" $(ps -p $OGPID -o %cpu= 2>/dev/null) 2>/dev/null) + OGCPU=$(top -b -n 1 -p $OGPID 2>/dev/null | awk -v p=$OGPID '$1~p {printf "%d",$9}') if [ $OGCPU -gt 90 ]; then - date +"%d/%m/%Y %T AVISO: ogAdmServer (PID=$OGPID) parado, consumiendo $OGCPU % de CPU" >> $LOGDIR/ogAdmServer.log + date +"%d/%m/%Y %H:%M AVISO: ogAdmServer (PID=$OGPID) parado, consumiendo $OGCPU % de CPU" >> $LOGDIR/ogAdmServer.log kill -9 $OGPID fi # Reiniciar servicios si proceso ogAdmServer está caído. if ! pgrep ogAdmServer >/dev/null; then - date +"%d/%m/%Y %T ERROR: El servicio ogAdmServer estaba caido, se reinicia" >> $LOGDIR/ogAdmServer.log + date +"%d/%m/%Y %H:%M ERROR: El servicio ogAdmServer estaba caido, se reinicia" >> $LOGDIR/ogAdmServer.log /etc/init.d/opengnsys restart fi fi # Reiniciar servicios si es repositorio y proceso ogAdmRepo está caído. if [ "$RUN_OGADMREPO" == "yes" -a $(pgrep ogAdmRepo | wc -w) == 0 ]; then - date +"%d/%m/%Y %T ERROR: El servicio ogAdmRepo estaba caido, se reinicia" >> $LOGDIR/ogAdmRepo.log + date +"%d/%m/%Y %H:%M ERROR: El servicio ogAdmRepo estaba caido, se reinicia" >> $LOGDIR/ogAdmRepo.log /etc/init.d/opengnsys restart fi |