Kerya techblog

Most Read Posts

  • Gentoo mail (postfix + postfixadmin + dovecot + amavisd-new + roundcube)
  • Zabbix - no such instance currently exists at this oid
  • LVM cant Boot - ALERT /dev/mapper/ubuntu--vg-root does not exist DROPPING to Shell -
  • liquidsoap-1.1.1 gentoo install
  • Laravel manual user register
  • Gentoo: php 5.6.0 + pecl-memcached 2.2.0 install script
  • Zabbix APC Smart UPS monitoring on FreeBSD with snmp
  • Squid 3.4 debian 7 install script
  • Подключение Foxgate S6224-S2 Ubuntu minicom
  • Abills
  • exim+dovecot+postfixadmin+clamav+spamassassin on FreeBSD
  • Openmeetings 2.1.1 Ubuntu 12.04.2 installation
  • libtool version mismatch pecl gentoo
  • Securing NTP
  • FreeBSD 9 ossec setup errors fix
  • Mikrotik no-ip ddns update script
  • Скопировать права mysql gentoo
  • fix for - corrupted record for package (pkgdep line without argument), ignoring
  • mysql backup scripts
  • snmpd less verbose log FreeBSD (Connection from UDP messages)
  1. Вы здесь:  
  2. Home
  • Home
  • Все статьи

Оптимизация изображений (pagespeed)

Подробности
Автор: Kirill

# cd <images_folder_orig>

# for IMAGE in $(find . -regextype posix-extended -regex '.*\.(jpg|jpeg|png)'); do jpegtran -copy none -progressive $IMAGE > ./optimized/$IMAGE ; done

# cd .. ; mv  <images_folder_orig> <images_folder_orig>.backup ; ln -s optimized/ <images_folder_orig>

Compilation/installation scripts (apache, php, etc.)

Подробности
Автор: Kirill

apache compilation

-----------------------------------------------------------------------

#!/bin/bash

version='2.4.12'
pushd /usr/src/
if [ ! -f /usr/src/httpd-${version}.tar.bz2 ]; then
    wget http://apache.volia.net/httpd/httpd-${version}.tar.bz2
fi
rm -rf /usr/src/httpd-2.4.12
tar xvf httpd-${version}.tar.bz2
cd /usr/src/httpd-${version}
/usr/bin/make clean
./configure \
    --prefix=/usr/local/apache-2.4 \
    #   --with-apr=/usr/local/apr-1.4.8 \
    #   --with-apr-util=/usr/src/apr-util-1.5.2

    /usr/bin/make -j8
    /usr/bin/make install

    #/usr/src/compile-mod_umask.sh
    #/usr/local/apache-2.4/bin/apxs -a -i -c /usr/src/mod_umask/src/mod_umask.c
popd

---------------------------------------------------------------------------------

php compilation :

---------------------------------------------------------------------------------

#!/bin/bash

version='5.6.9'

_wget='/usr/bin/wget'
_rm='/bin/rm'
_tar='/bin/tar'
_make='/usr/bin/make'

if [ ! -f /usr/src/php-${version}.tar.bz2 ] ; then
    ${_wget} http://ua2.php.net/distributions/php-${version}.tar.bz2
fi
pushd /usr/src/
${_rm} -rf php-${version}
${_tar} xvf php-${version}.tar.bz2

cd /usr/src/php-${version}
${_make} clean
./configure \
        --prefix=/usr/local/php-5.6 \
        --with-apxs2=/usr/local/apache-2.4.12/bin/apxs \
        --with-config-file-scan-dir=/usr/local/php-5.6/etc/ext-active \
        --with-mysql=/usr \
        --with-mysqli \
        --enable-dba \
        --enable-intl \
        --with-pdo-mysql=mysqlnd \
        --with-bz2 \
        --with-gd \
        --with-gettext \
        --with-zlib \
        --enable-zip \
        --enable-opcache \
        --enable-fpm \
        --enable-mbstring \
        --with-curl \
        --with-mcrypt

${_make} install -s

popd

-------------------------------------------------------

phpredis install script (gentoo, php 7)

--------------------------------

#!/bin/bash

php_ver='7.0'
if [ -d phpredis ]; then
    rm -rf phpredis
    git clone https://github.com/phpredis/phpredis.git
fi
cd phpredis
git checkout php7
/usr/lib64/php${php_ver}/bin/phpize
aclocal; libtoolize --force; autoheader; autoconf
PATH=/usr/lib64/php${php_ver}/bin/:$PATH ./configure
make
make install
if [ -f /etc/php/apache2-php${php_ver}/ext/redis.so ]; then
    bash -c "echo extension=redis.so > /etc/php/apache2-php${php_ver}/ext/redis.ini"
fi
if [ -f /etc/php/apache2-php${php_ver}/ext-active/redis.so ]; then
    cd /etc/php/apache2-php${php_ver}/ext-active/ && ln -s ../ext/redis.so
fi

--------------------------------------------------------------

Mysqldump one table via ssh and gzip

Подробности
Автор: Kirill

mysqldump <source_db> <source_table> | gzip -9 |  ssh <target_server_IP> "gunzip - | mysql <target_db>"

via cron:

*/10 * * * * root mysqldump --defaults-extra-file="/root/.my.cnf" <source_db> <source_table> | gzip -9 |  ssh <target_server_IP> "gunzip - | mysql <target_db>"

example:

mysqldump testdb table1 | gzip -9 |  ssh 192.168.0.1 "gunzip - | mysql testdb2"

Gentoo statistic script

Подробности
Автор: Kirill

in /etc/crontab :

*/3 * * * * root /usr/local/bin/check_la.sh

------------------------------------------

/usr/local/bin/check_la.sh :

if [[ $(uptime | sed -e 's/.*average:\ \(.*\)\..*,.*,.*/\1/') -ge 16 ]]; then

/usr/local/bin/stat.sh > /var/tmp/stat-$(date "+%Y_%d_%m-%H:%M")

fi

-----------------------------------------

/usr/local/bin/stat.sh :

#!/bin/sh

make_stat() {
        echo -e "\n\n\n========================= processes ===================\n"
        ps wwaux
        echo -e "\n\n\n========================= http requests ===================\n"
        links -dump http://localhost/server-status
        echo -e "\n\n\n========================= mysql threads ==================="
        mysql -u root --exec "SHOW FULL PROCESSLIST"
        echo -e "\n\n\n========================= network connections ===================\n"
        netstat -ant
        echo -e "\n\n\n========================= memory ===================\n"
        free
        echo -e "\n\n###############################################\n\n"
}


if [ $(ps aux | grep apache | wc -l) -ge 2 -a  $(ps aux | grep mysql | grep -v grep | wc -l) -ge 0 ] ; then
        outfile=${1:-/dev/stdout}
        cat /dev/null > $outfile
        make_stat >> $outfile
fi

 

  1. redmine upgrade (Ubuntu to Gentoo)
  2. snmpd less verbose log FreeBSD (Connection from UDP messages)

Страница 12 из 18

  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

Search

Older Posts

  • zerotier one add more routes (51)
  • modsecurity for nginx compilation scripts for freebsd (435)
  • Greenbone Vulnerability Manager (GVM) hacks (509)
  • elasticsearch cluster red status fix due to high watermark (404)
  • ubuntu arrow keys misbehaviour fix (486)
  • icinga IIS monitoring powershell error Get-WmiObject : Invalid namespace "root\WebAdministration" (481)
  • Make user superadmin in zabbix (532)
  • dnf Error: unknown option (638)
  • unpack pfx certificate (used for apache or nginx) (460)
  • mysql audit plugin build script (753)
  • mysql dump one row (544)
  • redmine 5 docker-compose (710)
  • gitlab runner dind docker-compose (521)
  • AWS S3 IAM policy to limit to single sub folder (469)
  • logrotate hints (639)

Login Form

  • Забыли пароль?
  • Забыли логин?
  • Регистрация