tag:blogger.com,1999:blog-39976300924481067972023-11-15T19:07:56.892+02:00Notes System Administratorlinux, servers, www, network ...Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.comBlogger152125tag:blogger.com,1999:blog-3997630092448106797.post-54027992833364162062013-09-27T13:43:00.002+03:002013-09-27T13:43:45.337+03:00python readline# sudo aptitude install build-essential libreadline6-dev<br />
<br />
#cd Python-<x>.<y>.<z></z></y></x><br />
<br />
# sed 's/#readline/readline/' Modules/Setup.dist > file.tmp && mv file.tmp Modules/Setup.dist<br />
<br />
#./configure <your options=""></your><br />
#make<br />
#make installВолодяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-90579340630982590802013-09-20T16:57:00.004+03:002013-09-20T16:57:51.784+03:00Nagios Indicator<strong>Gnome indicator for nagios</strong><br /><br />It adds icon indicator to gnome panel. <br />
This applet automatically check your nagios server and notify about all problems using popup messages.<br />
<br />
<br />
https://github.com/volodymyrko/nagios_indicatorВолодяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-27174759289008501442013-06-27T10:02:00.001+03:002013-06-27T10:02:17.344+03:00mysql: find InnoDB table size<h2>
How to find Innodb tables size?</h2>
"<span style="color: #0b5394;">show table status</span>" command doesn't show separated Innodb tables size, it showes total InnoDB data size. So we can use INFORMATION_SCHEMA for finding size of each InnoDB table.<br />
<br />
for example, try find 10 biggest InnoDB tables:<br />
<br />
<span style="color: #0b5394;">#mysql -A</span><span style="color: #0b5394;"><br /></span><br />
<span style="color: #0b5394;"><br /></span>
<span style="color: #0b5394;">mysql> use INFORMATION_SCHEMA</span><br />
<span style="color: #0b5394;">mysql> SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE, TABLE_ROWS, DATA_LENGTH, INDEX_LENGTH, CREATE_TIME, UPDATE_TIME FROM TABLES WHERE ENGINE='InnoDB' ORDER BY DATA_LENGTH DESC limit 10;</span><span style="color: #0b5394;"><br /></span><br />
<span style="color: #0b5394;"><br /></span>
<br />
using INFORMATION_SCHEMA you can find data_length, index_length and other useful informationВолодяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-43086555404268771542013-05-29T13:20:00.000+03:002013-05-29T13:20:02.388+03:00mysql: How find fragmented MySQL tables#mysql<br />
<br />
> use information_schema<br />
<br />
> select ENGINE, TABLE_NAME,Round( DATA_LENGTH/1024/1024) as data_length , round(INDEX_LENGTH/1024/1024) as index_length, round(DATA_FREE/ 1024/1024) as data_free from information_schema.tables where DATA_FREE > 0;<br />
<br />
<br />
<br />
<br />
The "<strong>You must to know</strong>" answer<br /><br />first at all you must to understand that Mysql tables get fragmented when update a row, so it's a normal situation. When a table is created, lets say imported using a dump with data, all rows are stored with no fragmentation in many fixed size pages. When you update a variable length row, the page containing this row is divided in two or more pages to store the changes, and these new two(or more) pages contains blank spaces filling the unused space.<br /><br />This does not impact in your performance, unless of course the fragmentation growth too much. What is too much fragmentation, well let's see the query you're looking for:<br /><br /> select ENGINE, TABLE_NAME,Round( DATA_LENGTH/1024/1024) as data_length , round(INDEX_LENGTH/1024/1024) as index_length, round(DATA_FREE/ 1024/1024) as data_free from information_schema.tables where DATA_FREE > 0;<br /><br />The DATA_LENGTH and INDEX_LENGTH are the space your data and indexes are using, and DATA_FREE is the total amount of bytes unused in all the table pages (fragmentation).<br /><br />Here's an example of real production table<br /><br />| ENGINE | TABLE_NAME | data_length | index_length | data_free |<br />| InnoDB | comments | 896 | 316 | 5 |<br /><br />In this case we have a Table using (896 + 316) = 1212 MB, and have data a free space of 5 MB. This means a "ratio of fragmentation" of:<br /><br />5/1212 = 0.0041<br /><br />...Which is a really low "fragmentation ratio".<br /><br />I've been working with tables with a ratio near 0.2 (meaning 20% of blank spaces) and never notice a slow down on queries, even if I optimize the table, the performance is the same. But apply a optimize table on a 800MB table takes a lot of time and blocks the table for several minutes, impracticable on production.<br /><br />So, if you consider what you win in performance and the time wasted in optimize a table, I prefer NOT OPTIMIZE.<br /><br />If you think it's better for storage, see your ratio and see how much space can you save when optimize. It's usually not too much, so I prefer NOT OPTIMIZE.<br /><br />And if you optimize, the next update will create blank spaces by splitting a page in two or more. But it's faster to update a fragmented table than a not fragmented one, because if the table is fragmented an update on a row not necessarily will split a page.<br /><br />I hope this help you. <br />
<br />
<br />
<br />
http://serverfault.com/questions/202000/how-find-and-fix-fragmented-mysql-tables<br />
http://dba.stackexchange.com/questions/16341/how-do-you-remove-fragmentation-from-innodb-tables<br />
<br />Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-48713499589631517452013-05-27T11:47:00.002+03:002013-05-27T11:47:57.854+03:00Add virtualhost name to apache logfileIf you have many ServerAlias in some apache VirtualHost and You want to see name of virtualhost in lofgile add <strong><span style="color: #0b5394;">%{host}i </span></strong>to logformat direcive,<br />
<br />
for example,<br />
<br />
<span style="color: #0b5394;">LogFormat "%h %{host}i %l %u %D %T %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined</span>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-52513829877648371872013-05-27T10:32:00.000+03:002013-05-27T10:32:11.496+03:00php performancestrace huge lstat try:<br />
php.ini<br />
<br />
<br />
; ...<br />; Determines the size of the realpath cache to be used by PHP. This value should<br />; be increased on systems where PHP opens many files to reflect the quantity of<br />; the file operations performed.<br />realpath_cache_size=1M<br /> <br />; Duration of time, in seconds for which to cache realpath information for a given<br />; file or directory. For systems with rarely changing files, consider increasing this<br />; value.<br />realpath_cache_ttl=300<br />; ...Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-21173674860695655882013-03-29T11:40:00.000+02:002013-03-29T11:40:09.222+02:00bash: як замінити стрічку у файлімаємо файл file.txt<br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;"># cat file.txt</span></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;">this is simple text file</span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;"><br /></span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;">here is 1-st line</span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;"><br /></span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;">4-th line</span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;"><br /></span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;">some 3-rd line</span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;"><br /></span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;">end of file</span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Наприклад, треба замінити стрічку яка містить "4-th line" . Зробити це можна за допомогою sed-у:</span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<span style="color: #0b5394;"><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"># cat file.txt | sed '/4-th line/c 2-nd line'<br />this is simple text file<br />here is 1-st line<br />2-nd line<br />some 3-rd line<br />end of file</span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Але треба памятати, що sed міняє сам файл у такому випадку. Тому, якщо треба змнити файл, можна зробити шось таке:</span><span style="font-size: small;"><br /></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="color: #0b5394;"># cat file.txt | sed '/4-th line/c 2-nd line' > tmp.txt && mv tmp.txt file.txt</span></span> </span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">таким вийшов новий файл</span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"># cat file.txt<br />this is simple text file<br />here is 1-st line<br />2-nd line<br />some 3-rd line<br />end of file</span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><br /></span></span>
<br />
<br />Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-4163381632877007232013-03-13T12:04:00.001+02:002013-03-13T12:04:44.392+02:00Запуск django/flask аплікацій за допомгою supervisordІснує декілька варіантів запуску django як fastcgi-серверу на продакшин-серверах. Типовим варіантом є написання startup-скрпту і розміщення його в /etc/init.d/ (детальніше <a href="https://code.djangoproject.com/wiki/InitdScriptForLinux" target="_blank">https://code.djangoproject.com/wiki/InitdScriptForLinux</a>).<br />
<br />
Доволі зручним для запуску і контролю над django-програмами є supervisord. <a href="http://supervisord.org/" target="_blank">Supervisord</a> дозволяє користувачам здійснювати моніторинг і контроль ряд процесів в UNIX-таких операційних систем. Його можна використовувати для запуску та конторлю різноманітних сервісів, зокрема django, celery, tornado, flask<br />
<br />
Встанолюємо (на debain) supervisord:<br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">aptitude install supervisor</span></span><br />
<br />
supervisor напсианий на python-і, тому його можна і встановлювати за допомгою easy_install, pip ... Але якщо у вас немає потреб встановлювати певно кокретної версії, то краще скористатися штатним пакетним менеджером (aptitude, apt-get в debian-і)<br />
<br />
<br />
конфігураціїні файли supervisor-а знаходяться в директорії <span style="color: #073763;">/etc/supervisor</span><span style="color: #134f5c;">:</span><br />
<span style="color: #134f5c;">/etc/supervisor/supervisord.conf</span> - конф. файл самого supervisor-а,<br />
а файли з лписом наших сервісів (зокрема django), які ми будемо запускати, повинні знаходитися в <span style="color: #073763;">/etc/supervisor/conf.d/</span><br />
<br />
ось, як виглядає конфігураційний файл (<span style="color: #073763;">/etc/supervisor/conf.d/project.conf</span>) для запуску django :<br />
<br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">[program:project] <span style="font-size: x-small;"><em> </em></span></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: x-small;"><em># тут project - це унікальне імє проекту</em></span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br />command = /home/user/www/project/.env/bin/python manage.py runfcgi host=127.0.0.1 port=10889 daemonize=false<br />directory = /home/user/www/project/<br />user = user<br />autostart=true<br />autorestart=true<br />startsecs = 3<br />redirect_stderr=true<br />stdout_logfile=/var/log/supervisor/project.log</span></span><br />
<br />
отже створили файл, далі запускаємо:<br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">supervisorctl reread</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">supervisorctl update</span></span><br />
<br />
і дивимося статус:<br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">supervisorctl status</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">project RUNNING pid 2637, uptime 0:25:13</span></span><br />
<br />
<br />
і ще приклад для flask-аплікації, яка запускається за допомогою gunicorn<br />
<br />
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">[program:flask_app]<br />command = /home/user/flask/flask_app/.env/bin/gunicorn flask_app:app -b 127.0.0.1:10081<br />directory = /home/user/flask/flask_app/<br />user = user<br />autostart=true<br />autorestart=true<br />startsecs = 3<br />redirect_stderr=true<br />stdout_logfile=/var/log/supervisor/flask_app.gunicorn.log</span></span><br />
<br />Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-47694205371042568352013-03-12T13:01:00.000+02:002013-03-13T11:28:18.354+02:00Встановлення svn серверу на debian з підтримкою cyrus-sasl2Встановлємо сам svn<br />
<br />
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">aptitude install subversion</span></span><br />
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">aptitude install </span></span><span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">sasl2-bin libsasl2-modules libsasl2-2</span></span><br />
<br />
додаємо користувача<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">useradd -d /var/lib/svn/ -r -s /bin/false svn</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
створюємо домашній каталог, де і будуть розміщені наші svn-репозиторії<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">mkdir /var/lib/svn</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">chmod 750 /var/lib/svn/</span></span><br />
<br />
створюємо сам репозиторій з іменем project<br />
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">sudo -u svn svnadmin create project</span></span><br />
<br />
<br />
редагуємо /var/lib/svn/project/conf/svnserve.conf:<br />
<br />
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">[general]</span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;">anon-access = none</span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;">auth-access = write</span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;">realm = Project</span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;">[sasl]</span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;">use-sasl = true</span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;">min-encryption = 128</span><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span><span style="font-family: "Trebuchet MS", sans-serif;">max-encryption = 256</span></span><i><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span></i><br />
<i><span style="font-family: "Trebuchet MS", sans-serif;"><br /></span></i>
<br />
створємо файл /usr/lib/sasl2/svn.conf з таким вмістом<br />
<br />
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">pwcheck_method: auxprop<br />auxprop_plugin: sasldb<br />sasldb_path: /var/lib/svn/project/passwd.db<br />mech_list: DIGEST-MD5</span></span><span style="font-family: "Trebuchet MS", sans-serif;"> </span><br />
<br />
<span style="font-family: inherit;">/var/lib/svn/project/passwd.db - це файл з паролями</span><br />
<br />
додати користувача можна командою:<br />
<span style="color: #0b5394;"><span style="font-family: "Trebuchet MS", sans-serif;">saslpasswd2 -f /var/lib/svn/project/passwd.db -u Project -c </span></span> <br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">wget wget http://odyniec.net/articles/ubuntu-subversion-server/svnserve</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
<span style="font-family: inherit;">додаємо до start-stop-daemon опцію " --chuid svn:svn "</span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">chmod u+x </span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">svnserve</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">mv </span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">svnserve /etc/init.d/</span></span><span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">svnserve</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">update-rc.d svnserve defaults</span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;"><br /></span></span>
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="color: #0b5394;">/etc/init.d/svnserve start </span></span><br />
<br />
<br />Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-89282185135368182952013-01-02T15:13:00.002+02:002013-01-02T15:13:52.995+02:00django startup script<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">#!/bin/sh -u</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span>
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">ROOT_DIR="/data/www"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">PIDFILE="${ROOT_DIR}/django.pid"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">SITE_DIR="${ROOT_DIR}/site"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">USER="vova"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span>
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">MANAGE="$SITE_DIR/wmf/manage.py"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">COMMAND="${SITE_DIR}/.env/bin/python"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">PORT="10080"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">HOST="127.0.0.1"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">OPTIONS="$MANAGE runfcgi method=threaded host=${HOST} port=${PORT} pidfile=${PIDFILE}"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span>
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">case "$1" in</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> start)</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> echo "Starting django site ...";</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> /sbin/start-stop-daemon -S -p ${PIDFILE} -c ${USER} --exec $COMMAND -- $OPTIONS</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> ;;</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> stop)</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> echo "Stoping django site ...";</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> /sbin/start-stop-daemon -Kp ${PIDFILE}</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> test -f ${PIDFILE} && rm ${PIDFILE}</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> ;;</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> restart|reload)</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> echo "Restarting api2 server ...";</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> $0 stop;</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> sleep 1;</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> $0 start;</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> ;;</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> *)</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> echo "use $0: stop|start"</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"> ;;</span></em></span><span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></em></span><br />
<span style="font-size: x-small;"><em><span style="font-family: Arial, Helvetica, sans-serif;">esac</span></em></span><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">where (django-1.5):</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><span style="font-size: x-small;"># ls -1a /data/www/site<br />.env/<br />.git/<br />.gitignore<br />README.md<br />requirements.txt<br />wmf/</span></span><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span>
<span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"># ls -1a /data/www/site/wmf/<br />manage.py<br />media/<br />static/<br />wmf/</span></span><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-75348724655037633692012-08-15T15:38:00.001+03:002012-08-15T15:38:24.881+03:00<span style="color: #0b5394;"><span style="font-family: "Courier New", Courier, monospace;">[alert] [client 192.168.1.2] /home/www/domains/domain.com/htdocs/.htaccess: AuthType not allowed her</span></span><span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;">e</span></span><br />
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="font-family: Arial, Helvetica, sans-serif;">to fix add to config AuthConfig option to AllowOverride directive:</span><span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"><br /></span></span><br />
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"><directory domain.com="domain.com" domains="domains" home="home" htdocs="htdocs" www="www"><br /></directory></span></span>
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"> AllowOverride ....... AuthConfig</span></span><span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"> ......</span></span><br />
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"> ......</span></span><br />
<span style="color: #0b5394;"><span style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"></span></span><br />
Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-31875245473677865032012-08-15T10:43:00.002+03:002012-08-15T10:43:26.304+03:00gentoo portage archiveIndex of /gentoo/portage-archive/2011/portage-20111215/app-emulation/lxc/Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-45116963448207770452012-08-15T10:19:00.001+03:002012-08-15T10:19:19.108+03:00gentoo pecl-memcache problem<span style="color: #073763;"><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">memcache-2.2.6 # make</span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">/bin/sh /home/vova/memcache-2.2.6/libtool --mode=compile cc -I/usr/lib64/php5.2/include/php -I. -I/home/vova/memcache-2.2.6 -DPHP_ATOM_INC -I/home/vova/memcache-2.2.6/include -I/home/vova/memcache-2.2.6/main -I/home/vova/memcache-2.2.6 -I/usr/lib64/php5.2/include/php -I/usr/lib64/php5.2/include/php/main -I/usr/lib64/php5.2/include/php/TSRM -I/usr/lib64/php5.2/include/php/Zend -I/usr/lib64/php5.2/include/php/ext -I/usr/lib64/php5.2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /home/vova/memcache-2.2.6/memcache.c -o memcache.lo </span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">/home/vova/memcache-2.2.6/libtool: line 481: CDPATH: command not found</span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">libtool: Version mismatch error. This is libtool 2.4, but the</span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">libtool: definition of this LT_INIT comes from an older release.</span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">libtool: You should recreate aclocal.m4 with macros from libtool 2.4</span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">libtool: and run autoconf again.</span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;">make: *** [memcache.lo] Error 63</span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><br />
<span style="font-size: x-small;"><span style="font-family: Verdana, sans-serif;"><br /></span></span>
<br />
If you have error with libtool version after make - way to install:<br />phpize --clean && phpize<br />rm aclocal.m4<br />aclocal<br />autoconf<br />./configure<br />make<br />make install<br />[memcache-2.2.6, gentoo.x86-64]Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-5839668443870353132012-07-31T10:42:00.001+03:002012-07-31T10:42:56.740+03:00fail2ban: Fix for iptables actions failing when run concurrentlyActions that call iptables fail when they are run at the same time by separate threads. I have added a lock to disallow prevent the problem. The patch should be applied to server/action.py<br />
<br />
download there:<br />
<a href="http://sourceforge.net/tracker/?func=detail&aid=3413485&group_id=121032&atid=689046">http://sourceforge.net/tracker/?func=detail&aid=3413485&group_id=121032&atid=689046</a>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-14108016731141077312012-07-31T10:16:00.000+03:002012-07-31T10:16:28.015+03:00How to show the Grub 2 menu at boot time <br /><br />To show the Grub 2 menu at boot time it is only the right hand shift key that works<br />Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-26216090014192575842012-07-31T10:00:00.004+03:002012-07-31T10:00:25.621+03:00directadmin: How to disable count directory size in file managerif you want to disable count summary directory size in directadmin filemanager add <span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">filemanager_du=0</span></span> to <span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">directadmin.conf</span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">cat /usr/local/directadmin/conf/directadmin.conf</span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">...</span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">filemanager_du=0</span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">...</span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span><br />
<span style="font-family: "Times", "Times New Roman", serif;">than restart directadmin:</span><br />
<span style="font-family: "Times", "Times New Roman", serif;"><br /></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">/etc/init.d/directadmin restart</span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-81098466267367424782012-07-31T09:57:00.000+03:002012-07-31T09:57:02.129+03:00nginx: Too many open filesif you have error:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">socket() failed (24: Too many open files)</span></span></blockquote>
<br />
you need change <strong>worker_rlimit_nofile</strong> in nginx.conf . (Default: 1024)<br />
<span style="color: #073763;"><br /></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">#cat /etc/nginx/nginx.conf</span></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">user www-data;</span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">worker_processes 1;</span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">error_log /var/log/nginx/error.log;</span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">pid /var/run/nginx.pid;</span></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><strong><span style="color: #073763;">worker_rlimit_nofile 4096; ### default is 1024</span></strong></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">events {</span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"> worker_connections 1024;</span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"> # multi_accept on;</span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;">}</span></span><span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><br />
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #073763;"><br /></span></span><br />
<span style="font-family: "Times", "Times New Roman", serif;">than restart (reload) nginx </span><span style="color: #0c343d;"><span style="font-family: "Times", "Times New Roman", serif;"> </span><span style="font-family: "Times", "Times New Roman", serif;">/etc/init.d/nginx restart</span></span><span style="font-family: "Times", "Times New Roman", serif;"><br /></span><br />
<span style="font-family: "Times", "Times New Roman", serif;"><br /></span><br />
<span style="font-family: "Times", "Times New Roman", serif;">and check :</span><br />
<span style="font-family: "Times", "Times New Roman", serif;"><span style="color: #073763;"><br /></span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">#ps waux|grep nginx</span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"> root 2604 0.0 0.0 9252 908 pts/0 S+ 09:53 0:00 grep --color=auto nginx</span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"> root 3330 0.0 0.2 113516 40324 ? Ss Jul26 0:00 nginx: master process /usr/sbin/nginx</span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"> www-data </span><strong><span style="font-family: "Courier New", "Courier", monospace;">18098</span></strong><span style="font-family: "Courier New", "Courier", monospace;"> 0.7 0.2 113516 40168 ? S Jul30 10:35 nginx: worker process</span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span><br />
<span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">#</span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;">cat /proc/</span><strong><span style="font-family: "Courier New", "Courier", monospace;">18098</span></strong><span style="font-family: "Courier New", "Courier", monospace;">/limits |grep files</span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></span><span style="color: #073763;"><span style="font-family: "Courier New", "Courier", monospace;"> Max open files 4096 4096 files </span></span><span style="font-family: "Helvetica Neue", "Arial", "Helvetica", sans-serif;"><span style="color: #134f5c;"><br /></span></span><br />
<span style="font-family: "Helvetica Neue", "Arial", "Helvetica", sans-serif;"><span style="color: #134f5c;"><br /></span></span><span style="font-family: "Helvetica Neue", "Arial", "Helvetica", sans-serif;"><span style="color: #0c343d;"><br /></span></span>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-12378551912293161082012-07-11T11:21:00.004+03:002012-07-11T11:22:25.331+03:00install mod_rpaf with apache-2.4<br />
Apache-2.4 has own module <a href="http://httpd.apache.org/docs/current/mod/mod_remoteip.html" target="_blank">mod_remoteip</a><br />
<br />
<i><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">"This module is used to treat the useragent which initiated the
request as the originating useragent as identified by httpd for the
purposes of authorization and logging, even where that useragent is
behind a load balancer, front end server, or proxy server."</span></i><br />
<br />
you may use it with nginx such:<br />
<span style="font-size: x-small;"><i><br /></i></span><br />
<span style="font-size: x-small;"><i>....</i></span><br />
<i style="background-color: white; font-size: small;"> RemoteIPHeader X-Forwarded-For</i><br />
<i style="background-color: white; font-size: small;">....</i><br />
<br />
but I found 2 issues for me:<br />
<br />
1. I must change LogFormat ( replace %h with %a) to show original IP in logs<br />
2. /server-status/ page show nginx ip address instead original<br />
<br />
So, i deside to use mod_rpaf. Defaut veriosn does not compile with aapche-2.4.<br />
To solve the issue:<br />
<span style="background-color: white;"><br /></span><br />
<span style="background-color: white;"><b><span style="font-size: large;"> replace “remote_”
with “client_” in “mod_rpaf-2.0.c” </span></b></span><br />
<span style="background-color: white;"><b><br /></b></span><br />
make it:<br />
<br />
<b>apxs -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c</b><br />
<br />
or install<br />
<br />
<b>apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c</b><br />
<br />
and use it with apache<br />
<br />
<br />
<i><span style="font-size: x-small;"><ifmodule rpaf_module=""></ifmodule></span></i><br />
<i><span style="font-size: x-small;"> RPAFenable On</span></i><br />
<i><span style="font-size: x-small;"> RPAFproxy_ips 127.0.0.1 </span></i><br />
<i><span style="font-size: x-small;"> RPAFsethostname On</span></i><br />
<i><span style="font-size: x-small;"> RPAFheader X-Forwarded-For</span></i><br />
<i><span style="font-size: x-small;"></span></i><br />
<div>
<br /></div>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com4tag:blogger.com,1999:blog-3997630092448106797.post-86411734874467740842012-07-05T13:16:00.003+03:002012-07-05T13:16:58.235+03:00libtool: link: cannot find the library `/usr/local/apr/lib/libexpat.la'<br />
<div class="post-body entry-content" id="post-body-4028379129963323422" style="position: relative; width: 536px;">
<div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;">
<span style="font-size: 13px; line-height: 18px;">I got this error, w</span><span style="background-color: white; font-size: 13px; line-height: 18px;">hen install apache on gentoo linux, rather </span><b style="background-color: white; font-size: small; line-height: 18px;">emere app-admin/apache-tools</b><span style="background-color: white; font-size: x-small; line-height: 18px;"> ends with error:</span></div>
<div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;">
<span style="background-color: white; font-size: 13px; line-height: 18px;"><br /></span></div>
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"><span style="line-height: 18px;"><br /></span></span></div>
<div class="post-body entry-content" id="post-body-4028379129963323422" style="position: relative; width: 536px;">
<pre style="background-color: #eeeeee; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 536px;"><span style="line-height: 18px;">libtool: link: cannot find the library `/usr/lib64/libexpat.la' or unhandled argument `/usr/lib64/libexpat.la'
make[1]: *** [htpasswd] Помилка 1
make[1]: *** Очікування завершення завдань...
libtool: link: cannot find the library `/usr/lib64/libexpat.la' or unhandled argument `/usr/lib64/libexpat.la'
make[1]: *** [htdigest] Помилка 1
libtool: link: cannot find the library `/usr/lib64/libexpat.la' or unhandled argument `/usr/lib64/libexpat.la'
make[1]: *** [rotatelogs] Помилка 1
make[1]: Залишаю каталог "/var/tmp/portage/app-admin/apache-tools-2.2.22/work/httpd-2.2.22/support"
make: *** [all-recursive] Помилка 1</span><span style="color: black; line-height: 18px;">
</span></pre>
<div style="color: #444444;">
<span style="line-height: 18px;"><br /></span></div>
<div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;">
<span style="font-size: 13px; line-height: 18px;">
<br />I found such way to solve this issue:<br /></span></div>
<pre style="background-color: #eeeeee; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; color: black; font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 536px;"><span style="font-size: 13px; line-height: 18px;"><code>cd /var/tmp/portage/www-servers/apache-2.2.22-r1/work/httpd-2.2.22/srclib/apr-util/xml/expat/
./configure
# make
# cp libexpat.la /usr/lib/</code></span></pre>
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">
<br /><div>
<code>than, I can <b>emerge apache</b> without problem and errors.</code></div>
<div style="clear: both;">
</div>
</span><div style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;">
</div>
</div>
<div class="post-footer" style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 1.6; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 1.5em;">
</div>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com1tag:blogger.com,1999:blog-3997630092448106797.post-64753603907505735222011-12-28T10:29:00.001+02:002011-12-28T10:29:19.682+02:00bash: remove file extension<br />
To get filename without extention try this:<br />
<div>
<div class="smallfont" style="background-color: #f5f5ff; font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font: normal normal normal 11px/normal verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; margin-bottom: 2px;">
<div class="smallfont" style="font: normal normal normal 11px/normal verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; margin-bottom: 2px;">
<br />
<div class="smallfont" style="font: normal normal normal 11px/normal verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; margin-bottom: 2px;">
Code:</div>
<pre class="alt2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-style: inset; border-bottom-width: 1px; border-color: initial; border-left-style: inset; border-left-width: 1px; border-right-style: inset; border-right-width: 1px; border-top-style: inset; border-top-width: 1px; font-size: 13px; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px;">file='file.txt'
name=${f%\.*}
</pre>
<div>
<br /></div>
</div>
</div>
</div>
<br />
or<br />
<br />
<br />
<div>
<div class="smallfont" style="background-color: #f5f5ff; font: normal normal normal 11px/normal verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; margin-bottom: 2px;">
<div class="smallfont" style="font: normal normal normal 11px/normal verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; margin-bottom: 2px;">
<div style="font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;">
<br /></div>
<pre class="alt2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-style: inset; border-bottom-width: 1px; border-color: initial; border-left-style: inset; border-left-width: 1px; border-right-style: inset; border-right-width: 1px; border-top-style: inset; border-top-width: 1px; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px;"><div style="font-family: 'Times New Roman'; font-size: medium; white-space: normal;">
# echo file_name.jpg | sed 's/\(.*\)\..*/\1/'</div>
<div style="font-family: 'Times New Roman'; font-size: medium; white-space: normal;">
file_name</div>
<div style="font-family: 'Times New Roman'; font-size: medium; white-space: normal;">
#</div>
</pre>
<div style="font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;">
<br /></div>
</div>
</div>
</div>
<br />Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-41779904047484099262011-12-26T16:45:00.003+02:002011-12-26T16:45:36.906+02:00Sorry, but Nagios is currently not checking for external commands<br />
<div class="content" style="background-color: white; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: center; vertical-align: baseline;">
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span class="Apple-style-span" style="line-height: 18px;"><b>Sorry, but Nagios is currently not checking for external commands</b></span></span></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
<br /></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">You probably saw following message “Sorry, but Nagios is currently not checking for external commands, so your command will not be committed” when you tried to reschedule a service check in nagios web interface. The reason behind this is that nagios by default does not check for external commands. To resolve that problem we need to reconfigure nagios.</span></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To enable checking for external commands we have to edit main nagios configuration file nagios.cfg, which is usually located in /etc/nagios3. You have to change below line</span></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f4f4f4; background-image: initial; background-origin: initial; border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-bottom-width: 1px; border-color: initial; border-left-color: rgb(229, 229, 229); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(229, 229, 229); border-right-style: solid; border-right-width: 1px; border-style: initial; border-top-color: rgb(229, 229, 229); border-top-style: solid; border-top-width: 1px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; font: normal normal normal 1em/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; margin-bottom: 1.5em; margin-top: 1.5em; padding-bottom: 1em; padding-left: 1em; padding-right: 1em; padding-top: 1em; vertical-align: baseline; white-space: normal;">check_external_commands=0</pre>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">to</span></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f4f4f4; background-image: initial; background-origin: initial; border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-bottom-width: 1px; border-color: initial; border-left-color: rgb(229, 229, 229); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(229, 229, 229); border-right-style: solid; border-right-width: 1px; border-style: initial; border-top-color: rgb(229, 229, 229); border-top-style: solid; border-top-width: 1px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; font: normal normal normal 1em/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; margin-bottom: 1.5em; margin-top: 1.5em; padding-bottom: 1em; padding-left: 1em; padding-right: 1em; padding-top: 1em; vertical-align: baseline; white-space: normal;">check_external_commands=1</pre>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">and reload nagios using</span></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f4f4f4; background-image: initial; background-origin: initial; border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-bottom-width: 1px; border-color: initial; border-left-color: rgb(229, 229, 229); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(229, 229, 229); border-right-style: solid; border-right-width: 1px; border-style: initial; border-top-color: rgb(229, 229, 229); border-top-style: solid; border-top-width: 1px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; font: normal normal normal 1em/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; margin-bottom: 1.5em; margin-top: 1.5em; padding-bottom: 1em; padding-left: 1em; padding-right: 1em; padding-top: 1em; vertical-align: baseline; white-space: normal;">/etc/init.d/nagios3 reload</pre>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">When you try again to reschedule service check from web interface the following error can come up: Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!. This is because of the bug in Debian, which is described here <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #05a8e5; font-style: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;" title="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801</a>. The solution is quite simple:</span></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f4f4f4; background-image: initial; background-origin: initial; border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-bottom-width: 1px; border-color: initial; border-left-color: rgb(229, 229, 229); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(229, 229, 229); border-right-style: solid; border-right-width: 1px; border-style: initial; border-top-color: rgb(229, 229, 229); border-top-style: solid; border-top-width: 1px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; font: normal normal normal 1em/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; margin-bottom: 1.5em; margin-top: 1.5em; padding-bottom: 1em; padding-left: 1em; padding-right: 1em; padding-top: 1em; vertical-align: baseline; white-space: normal;"># /etc/init.d/nagios3 stop
Stopping nagios3 monitoring daemon: nagios3Waiting for nagios3 daemon to die...
.
# dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
# dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
# /etc/init.d/nagios3 start
Starting nagios3 monitoring daemon: nagios3. </pre>
<div style="color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;">
<br /></div>
<div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: inherit; font-size: 12px; font-style: inherit; line-height: 18px; margin-bottom: 0.725em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify; vertical-align: baseline;">
</div>
</div>
<ul class="links inline" style="background-color: white; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; display: inline; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"></ul>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-17640443653059456982011-12-26T11:50:00.002+02:002011-12-26T11:50:52.635+02:00How to flush DNS cache in Windows/Linux/Mac Os<br />
<div style="background-color: white; color: #333333; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; text-align: justify;">
<strong>To flush DNS cache in Microsoft Windows (Win XP, Win ME, Win 2000):-</strong></div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 5px; color: #777777; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; margin-bottom: 0px; margin-left: 10px; margin-right: 30px; margin-top: 15px; padding-left: 20px; text-align: justify;">
- Start -> Run -> type <strong>cmd</strong><br />- in command prompt, type <strong>ipconfig /flushdns</strong><br />- Done! You Window DNS cache has just been flush.</blockquote>
<div style="background-color: white; color: #333333; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; text-align: justify;">
<strong>To flush the DNS cache in Linux, restart the nscd daemon:-</strong></div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 5px; color: #777777; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; margin-bottom: 0px; margin-left: 10px; margin-right: 30px; margin-top: 15px; padding-left: 20px; text-align: justify;">
<span id="more-35"></span><br />- To restart the nscd daemon, type <strong>/etc/rc.d/init.d/nscd restart</strong> in your terminal<br />- Once you run the command your linux DNS cache will flush.</blockquote>
<div style="background-color: white; color: #333333; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; text-align: justify;">
<strong>To flush the DNS cache in Mac OS X Leopard:-</strong></div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 5px; color: #777777; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; margin-bottom: 0px; margin-left: 10px; margin-right: 30px; margin-top: 15px; padding-left: 20px; text-align: justify;">
- type <strong>lookupd -flushcache</strong> in your terminal to flush the DNS resolver cache.<br />ex: bash-2.05a$ <strong>lookupd -flushcache</strong><br />- Once you run the command your DNS cache (in Mac OS X) will flush.</blockquote>
<div style="background-color: white; color: #333333; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; text-align: justify;">
<strong>To flush the DNS cache in Mac OS X:-</strong></div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 5px; color: #777777; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 12px; line-height: 25px; margin-bottom: 0px; margin-left: 10px; margin-right: 30px; margin-top: 15px; padding-left: 20px; text-align: justify;">
- type <strong>dscacheutil -flushcache</strong> in your terminal to flush the DNS resolver cache.<br />ex: bash-2.05a$ <strong>dscacheutil -flushcache</strong><br />- Once you run the command your DNS cache (in Mac OS X Leopard) will flush.<br />
<div>
<br /></div>
</blockquote>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-27718519967216413582011-12-25T16:46:00.000+02:002011-12-25T16:46:40.326+02:00How to delete columns from an existing table in SQLite.<blockquote>
SQLite has limited
<a href="http://www.sqlite.org/lang_altertable.html">ALTER TABLE</a> support that you can
use to add a column to the end of a table or to change the name of
a table.
If you want to make more complex changes in the structure of a table,
you will have to recreate the
table. You can save existing data to a temporary table, drop the
old table, create the new table, then copy the data back in from
the temporary table.<br />
For example, suppose you have a table named "t1" with columns
names "a", "b", and "c" and that you want to delete column "c" from
this table. The following steps illustrate how this could be done:
<br />
<blockquote>
<pre>BEGIN TRANSACTION;
CREATE TEMPORARY TABLE t1_backup(a,b);
INSERT INTO t1_backup SELECT a,b FROM t1;
DROP TABLE t1;
CREATE TABLE t1(a,b);
INSERT INTO t1 SELECT a,b FROM t1_backup;
DROP TABLE t1_backup;
COMMIT;
</pre>
</blockquote>
</blockquote>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-62598134788260860322011-12-14T12:29:00.001+02:002011-12-14T12:53:49.378+02:00emerg] (28)No space left on device: Couldn't create accept lock (/var/lock/apache2/accept.lock)if you can't start apache and see this error in apache error.log:<br />
<br />
<br />
<div style="border-top-color: rgb(170, 177, 35); border-top-style: solid; border-top-width: 1px; margin-bottom: 1.571em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 22px;">
<code style="background-attachment: scroll; background-clip: initial; background-color: #eeeeee; background-image: none; background-origin: initial; background-position: 0px 0px; background-repeat: repeat repeat; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(221, 221, 221); border-top-style: solid; border-top-width: 1px; display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 0.667em; padding-left: 0.917em; padding-right: 0.917em; padding-top: 0.667em;">[emerg] (28)No space left on device: Couldn't create accept lock (/var/lock/apache2/accept.lock.11955) (5)</code></div>
<div>
<div style="background-color: white;">
<span class="Apple-style-span" style="color: #333333; font-family: arial, sans-serif;">may be several ways making:</span></div>
<div style="background-color: white;">
<span class="Apple-style-span" style="color: #333333; font-family: arial, sans-serif;"><br /></span></div>
<br />
<span class="Apple-style-span" style="background-color: white;"><ul style="color: #333333; font-family: arial, sans-serif;">
<li><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: arial, sans-serif;">you exceeded your disk limit.. see </span><span class="Apple-style-span" style="color: black; font-family: 'Courier New', Courier, monospace;"><i style="background-color: #d9ead3;">df -h</i></span><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: arial, sans-serif;"> to watch free space on disk ( /var partiotion )</span></li>
</ul>
<div style="color: #333333; font-family: arial, sans-serif;">
if you out of disk space free some space in /var to start apace</div>
<div>
<ul style="color: #333333; font-family: arial, sans-serif;">
<li>Check for semaphore-arrays owned by your apache-user ( www-data or apache ...)</li>
</ul>
<div style="color: #333333; font-family: arial, sans-serif;">
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 22px;">
<code style="background-attachment: scroll; background-clip: initial; background-color: #eeeeee; background-image: none; background-origin: initial; background-position: 0px 0px; background-repeat: repeat repeat; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(221, 221, 221); border-top-style: solid; border-top-width: 1px; display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 0.667em; padding-left: 0.917em; padding-right: 0.917em; padding-top: 0.667em;"># ipcs -s | grep www-data </code></div>
<div style="color: black; font-family: 'Times New Roman';">
</div>
</div>
<div style="color: #333333; font-family: arial, sans-serif;">
( where, www-data - apace user )</div>
<div style="color: #333333; font-family: arial, sans-serif;">
if you see there some process, you should remove the semaphores. It should immediately solve the problem.</div>
<div style="color: #333333; font-family: arial, sans-serif;">
<br /></div>
<div>
<div>
<div style="background-color: white;">
<code style="background-attachment: scroll; background-clip: initial; background-color: #eeeeee; background-image: none; background-origin: initial; background-position: 0px 0px; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(221, 221, 221); border-top-style: solid; border-top-width: 1px; color: #111111; display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 0.667em; padding-left: 0.917em; padding-right: 0.917em; padding-top: 0.667em; text-align: left;"># for semid in `ipcs -s | grep www-data | cut -f2 -d” “`; do ipcrm -s $semid; done</code><code style="background-attachment: scroll; background-clip: initial; background-color: #eeeeee; background-image: none; background-origin: initial; background-position: 0px 0px; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(221, 221, 221); border-top-style: solid; border-top-width: 1px; color: #111111; display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 0.667em; padding-left: 0.917em; padding-right: 0.917em; padding-top: 0.667em; text-align: left;">ipcs -s | grep www-data | awk '{ print $2 }' | xrags ipcrm sem</code></div>
</div>
</div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: monospace;"><br /></span></div>
</div>
<div style="text-align: left;">
<ul>
<li><span class="Apple-style-span" style="font-family: monospace;"> you can increase sysctl paramert </span><span style="color: black; font-family: Verdana, Arial, Helvetica;"><span style="color: black; font-family: Verdana, Arial, Helvetica;">kernel.sem </span></span></li>
</ul>
<span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica; font-size: x-small;"><br /></span></div>
<div>
<div>
<div>
<div style="background-color: white;">
<code style="background-attachment: scroll; background-clip: initial; background-color: #eeeeee; background-image: none; background-origin: initial; background-position: 0px 0px; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(221, 221, 221); border-top-style: solid; border-top-width: 1px; color: #111111; display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; line-height: 1.5em; margin-bottom: 1.833em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 0.667em; padding-left: 0.917em; padding-right: 0.917em; padding-top: 0.667em; text-align: left;"><span style="color: black; font-family: Verdana, Arial, Helvetica;"><span style="color: black; font-family: Verdana, Arial, Helvetica;">kernel.sem = 250 32000 100 256 </span></span></code></div>
<div>
<br /></div>
</div>
</div>
</div>
</span></div>
</div>Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0tag:blogger.com,1999:blog-3997630092448106797.post-6354806115962577302011-11-22T12:29:00.001+02:002011-11-22T12:30:39.303+02:00squid: 417 Expectation Failed<br />
<br />
<div style="background-color: white; color: #3b3b3b; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px; margin-bottom: 1.2em;">
</div>
<br />
<div style="margin-bottom: 1.2em;">
Many applications rely on using a special HTTP/1.1 header (Expect: 100-continue) when doing a POST, which is not happily supported by Squid.</div>
<div style="margin-bottom: 1.2em;">
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html" style="color: #0072b6; text-decoration: none;">RFC2616</a> says:</div>
<blockquote style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; font-style: italic; margin-bottom: 1.5em; margin-left: 10px; margin-right: 10px; margin-top: 1.5em; padding-bottom: 0.5em; padding-left: 10px; padding-right: 10px; padding-top: 0.5em;">
<div style="display: inline; margin-bottom: 1.2em;">
The purpose of the 100 (Continue) status (see section 10.1.1) is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking at the body. </div>
</blockquote>
<div style="margin-bottom: 1.2em;">
We can configure Squid to simply ignore that request header, and usually client with poor error handling will fallback without even notice it.</div>
<div style="margin-bottom: 1.2em;">
Add in squid.conf:<br /><code style="background-color: rgba(40, 40, 0, 0.0585938); font-family: Menlo, Consolas, 'Andale Mono', 'Lucida Console', 'Nimbus Mono L', 'DejaVu Sans Mono', monospace, 'Courier New'; font-size: 0.77em; padding-bottom: 0px; padding-left: 0.4em; padding-right: 0.4em; padding-top: 0px;">ignore_expect_100 on</code></div>
<div style="margin-bottom: 1.2em;">
and restart (reload) squid</div>
<div style="margin-bottom: 1.2em;">
<br /></div>
<br />
<br />
<br />Володяhttp://www.blogger.com/profile/12541188821152042152noreply@blogger.com0