02.25.10

OOF (out-of-fuel).

Posted in fun, linux at 1:49 pm by viliar

"An aircraft company discovered that it was cheaper to fly its planes
with less fuel on board. The planes would be lighter and use less fuel
and money was saved. On rare occasions however the amount of fuel was
insufficient, and the plane would crash. This problem was solved by
the engineers of the company by the development of a special OOF
(out-of-fuel) mechanism. In emergency cases a passenger was selected
and thrown out of the plane. (When necessary, the procedure was
repeated.)  A large body of theory was developed and many publications
were devoted to the problem of properly selecting the victim to be
ejected.  Should the victim be chosen at random? Or should one choose
the heaviest person? Or the oldest? Should passengers pay in order not
to be ejected, so that the victim would be the poorest on board? And
if for example the heaviest person was chosen, should there be a
special exception in case that was the pilot? Should first class
passengers be exempted?  Now that the OOF mechanism existed, it would
be activated every now and then, and eject passengers even when there
was no fuel shortage. The engineers are still studying precisely how
this malfunction is caused."
 http://lwn.net/Articles/104185/
Твердая пять :-D 

02.18.10

rpm packaging.

Posted in linux at 10:21 pm by viliar

Если не следовать умным документам, типа
RPM advanced docs

и правильно не именовать rpm пакеты c rc/pre версиями, можно вляпаться в следующее:
# rpm -Uhv –force /usr/src/redhat/RPMS/noarch/postfixadmin-2.3rc7-1.noarch.rpm
Preparing…                ########################################### [100%]
1:postfixadmin           ########################################### [100%]
# rpm -Uhv /usr/src/redhat/RPMS/noarch/postfixadmin-2.3-3.noarch.rpm
Preparing…                ########################################### [100%]
package postfixadmin-2.3rc7-1.noarch (which is newer than postfixadmin-2.3-3.noarch) is already installed

Беда. Пакет то уже в репозитарии и установлен в ряд систем. Тем не менее. Даже с такими кривыми руками можно жить, хотя, конечно, менее комфортно.
Добавляем в spec файл после Version и Release следующую строчку:
Epoch:          1

Пересобираем пакет. И вуаля:
# rpm -Uhv /usr/src/redhat/RPMS/noarch/postfixadmin-2.3-3.noarch.rpm
Preparing…                ########################################### [100%]
1:postfixadmin           ########################################### [100%]
Do not forget run upgrade.php!

Happy rpm packaging!

Update:

Пожалуй, на всякий случай приведу кусок текста, мало ли со временем та wiki помрет:

“Sometimes, program naming schemes are good, but rpm is lost. For example, with Proftpd, Pre-releases are named with the version followed by the suffix pre and then the pre version number, like so: 1.2.0pre5. Because of string comparisons, rpm thinks that 1.2.0pre5 is newer than 1.2.0 (we know that this is not true).

To permit upgrades to newer packages, we must help rpm to know which packages are newer than others. We could use the Epoch: tag (superseding the Serial: tag) but this is dirty. You have to use another naming convention, putting the “pre” stuff in the release tag; in our example you will call the package “1.2.0-0.pre5.1mdv”. Then, when 1.2.0 comes out, you’ll release “1.2.0-1mdv”, and this package will be able to upgrade the pre5.”

02.15.10

xentop long names.

Posted in opensource at 7:33 pm by viliar

В xentop слишком длинные имена отображаются не полностью, и в некоторых ситуациях не понятно, who is who.  Это справедливо для xen 3.3.2. Выше пока не смотрел, может что-то поправили. По мотивам http://www.wombattechnology.com.au/pages/articles/xentop-column-too-wide.php. У меня их решение не работает, то есть имя через /local/domain/$id/name меняется, но изменения не видны через xm top, xentop, xm list. Но имя можно записывать как через /local/domain/$id/name, так и через /vm/$uuid/name. Это работает. Подредактированный скрипт, если имя domU, как у нас, равно ip:

#!/bin/bash

TempFile="/root/xenlist"

#
# Get a list of domains.
#
xm list > $TempFile

let LineCount=1
exec < "$TempFile"
while read Line
do
DomainName=`echo "$Line" | awk '{ print $1 }' | sed -r 's/.*.([0-9]+.[0-9]+)/1/'`
if [ "$DomainName" != "Name" ]
then
if [ "$DomainName" != "Domain-0" ]
then
DomainId=`echo "$Line" | awk '{ print $2 }'`
DomainUuid=`xenstore-read /local/domain/$DomainId/vm`
#echo "DomainName $DomainName DomainId $DomainId DomainUuid $DomainUuid"
#echo "xenstore-write $DomainUuid/name $DomainName"
xenstore-write $DomainUuid/name $DomainName
let LineCount=$LineCount+1
fi
fi
done

rm -f $TempFile

Update: Аккуратнее, wordpress портит кавычки, а так же, как выяснилось, бэкслеши. Код для sed, там в замене бэкслеш перед единицей. Экранирование не помогает, а плагинов вставки кода в страницу для этой версии wordpress нет. Обновлять не хочется по ряду причин, времени переезжать на другой блоговый движок, к сожалению пока нет.

02.09.10

telnet from linux to windows. admin login.

Posted in linux at 2:00 am by viliar

Из серии очень специфического. Маловероятно, что кому-то пригодится, но мало ли.
telnet -8 -l `echo -n Администратор | iconv -f utf-8 -t cp866` 192.168.0.2

14 queries. 0.274 seconds