#!/bin/sh

dumpopts=" -h<host> -u<user> -p<password> --skip-opt  --add-drop-table --create-options --disable-keys --extended-insert --quick --set-charset"
_mysqldump="/usr/bin/mysqldump"
_gzip="/bin/gzip -9"
_echo="/bin/echo"
_date="/bin/date"
_find="/usr/bin/find"

cd /server/backup_mysql/sql_dumps

${_echo} "================================="
${_echo} "Backup script by kerya."
${_echo} "================================="
${_echo} " "

for dbname in `mysql -h<host> -u<user> -p<password> -N -B -e "show databases" | grep -v -E "information_schema|<excluded_db1>|<excluded_db2>|<excluded_dbN>"`
    do
    ${_echo} "Backup of db '$dbname' started at $(${_date})"
        ${_mysqldump}  $dumpopts $dbname | ${_gzip} > ${dbname}-`date "+%d.%m.%Y-%H:%M:%S"`.sql.gz;
    ${_echo} "Backup of db '$dbname' finished at  $(${_date})"

    ${_find} -name "${dbname}*" -mtime 3 -delete

done
exit

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

/usr/local/bin/mysqlbackup.sh :

#!/bin/bash
nice_=$(which nice)
gzip_=$(which gzip)
tar_=$(which tar)
#mongodump_=$(which mongodump)
list=$(/usr/bin/mysqlshow --defaults-file='/root/.my.cnf' 2>&1 | egrep -v 'Warning: Using a password' | egrep -v '(performance_schema|information_schema|pinba|Databases|-\-)'| tr -d "\|")
for i in $list; do /usr/bin/mysqldump --defaults-file='/root/.my.cnf' --single-transaction --skip-lock-tables --opt -B $i > $i.sql; done

#$mongodump_
#$mongodump_ -db local
#$tar_ czf mongo.tgz dump/ && rm -rf ./dump/

$nice_ -n 20 $gzip_ *.sql

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

Чтобы процесс записался в лог, можно использовать команду

tee <filename>

например:

./mysqlbackup.sh | tee mysqlbackup.log

Состоянием на 15.11.13 в дереве портов софтина отсутствует, но присутствует в оверлее pro-audio. Добавляем оверлей с помощью layman.

# emerge --sync

# emerge -av layman

# layman -a pro-audio

 * Adding overlay,...
 * Warning: an installed db file was not found at: ['/var/lib/layman/installed.xml']
 * Program "/usr/bin/svn" not found
 * File /usr/bin/svn seems to be missing! Overlay type "svn" not supported. Did you emerge dev-vcs/subversion?
 * Adding repository "pro-audio" failed!
 * Warning: an installed db file was not found at: ['/var/lib/layman/installed.xml']

 * CLI: Errors occurred processing action add
 * Adding repository "pro-audio" failed!

Ставим subversion

# emerge -av dev-vcs/subversion

Добавляем оверлей

# layman -a pro-audio

В низу вывода видим:

Checked out revision 2802.
 * Successfully added overlay(s) pro-audio.

Добавляем конфиг layman в make.conf

# echo "source /var/lib/layman/make.conf" >> /etc/portage/make.conf

Так как на момент написания этого эпоса, текущей версии 1.1.1 в оверлее нет, можно сделать небольшой хак:

# cd /var/lib/layman/pro-audio/media-radio/liquidsoap/
# cp liquidsoap-1.0.1.ebuild liquidsoap-1.1.1.ebuild
# ebuild liquidsoap-1.1.1.ebuild manifest

Если этого не сделать то получим сообщение:

Missing digest for '/var/lib/layman/pro-audio/media-radio/liquidsoap/liquidsoap-1.1.1.ebuild'

# emerge -av liquidsoap:1.1.1.ebuild

 * IMPORTANT: 7 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.


 * IMPORTANT: 2 config files in '/etc/portage' need updating.
 * See the CONFIGURATION FILES section of the emerge
 * man page to learn how to update config files.

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] media-libs/libogg-1.3.0  USE="-static-libs" 283 kB
[ebuild  N     ] media-fonts/dejavu-2.33  USE="-X -fontforge" 4,767 kB
[ebuild  N     ] dev-lang/ocaml-3.12.1  USE="gdbm ncurses ocamlopt -X -emacs -latex -tk -xemacs" 2,885 kB
[ebuild  N     ] media-libs/freetype-2.4.11:2  USE="bindist bzip2 -X -auto-hinter -debug -doc -fontforge -infinality -static-libs -utils" 1,510 kB
[ebuild  N     ] media-libs/audiofile-0.3.5:0/1  USE="-static-libs {-test}" 486 kB
[ebuild  N    ~] sys-libs/libmagic-0_alpha::proaudio  19 kB
[ebuild  N     ] media-libs/libpng-1.5.17-r1  USE="-apng (-neon) -static-libs" 705 kB
[ebuild  N     ] dev-lang/nasm-2.10.07  USE="-doc" 665 kB
[ebuild  N     ] dev-ml/findlib-1.4  USE="ocamlopt -doc -tk" 227 kB
[ebuild  N     ] media-libs/libsdl-1.2.15-r4  USE="audio joystick video -X -aalib -alsa -custom-cflags -dga -directfb -fbcon -ggi -libcaca -nas -opengl -oss (-ps3) -pulseaudio -static-libs (-svga) -tslib -xinerama -xv" 3,829 kB
[ebuild  N     ] media-sound/lame-3.99.5  USE="-debug (-mmx) -mp3rtp -sndfile -static-libs" 1,412 kB
[ebuild  N     ] media-libs/flac-1.2.1-r3  USE="cxx sse -3dnow (-altivec) -debug -ogg -static-libs" 1,971 kB
[ebuild  N     ] media-libs/libvorbis-1.3.3  USE="-static-libs" 1,063 kB
[ebuild  N     ] media-libs/gd-2.0.35-r3:2  USE="zlib -fontconfig -jpeg -png -static-libs -truetype -xpm" 1,185 kB
[ebuild  N     ] media-libs/libjpeg-turbo-1.3.0  USE="-java -static-libs" 1,344 kB
[ebuild  N    ~] dev-ml/ocaml-ogg-0.4.3::proaudio  107 kB
[ebuild  N     ] media-libs/sdl-ttf-2.0.11  USE="-X -static-libs" 3,959 kB
[ebuild  N     ] dev-ml/pcre-ocaml-6.2.5  USE="ocamlopt -examples" 60 kB
[ebuild  N    ~] dev-ml/ocaml-mm-0.2.0::proaudio  USE="-examples" 513 kB
[ebuild  N    ~] dev-ml/ocaml-taglib-0.2.0::proaudio  USE="-examples" 77 kB
[ebuild  N    ~] dev-ml/ocaml-magic-0.7.3::proaudio  54 kB
[ebuild  N    ~] dev-ml/ocaml-cry-0.2.2::proaudio  USE="-examples" 104 kB
[ebuild  N    ~] dev-ml/ocaml-dtools-0.2.2::proaudio  USE="-doc" 76 kB
[ebuild  N    ~] dev-ml/ocaml-flac-0.1.0::proaudio  USE="-examples" 90 kB
[ebuild  N    ~] dev-ml/camomile-0.8.4:0/0.8.4  USE="ocamlopt -debug" 2,588 kB
[ebuild  N    ~] dev-ml/ocaml-lame-0.3.1::proaudio  USE="-examples" 136 kB
[ebuild  N     ] media-libs/sdl-image-1.2.12  USE="-gif -jpeg -png -static-libs -tiff -webp" 2,179 kB
[ebuild  N     ] media-libs/sdl-mixer-1.2.12-r3  USE="wav -flac -fluidsynth -mad -midi -mikmod -mod -modplug -mp3 -playtools -smpeg -static-libs -timidity -vorbis" 3,621 kB
[ebuild  N     ] virtual/jpeg-0  USE="-static-libs" 0 kB
[ebuild  N    ~] dev-ml/gd4o-1.0_alpha5:0/1.0_alpha5  USE="ocamlopt -doc" 865 kB
[ebuild  N    ~] dev-ml/ocaml-vorbis-0.6.1::proaudio  USE="-examples" 114 kB
[ebuild  N    ~] dev-ml/ocaml-duppy-0.4.2::proaudio  USE="-examples" 122 kB
[ebuild  N    ~] dev-ml/ocamlsdl-0.9.1:0/0.9.1  USE="truetype -doc -opengl" 221 kB
[ebuild  N    ~] media-radio/liquidsoap-1.1.1::proaudio  USE="flac lame shout taglib unicode vorbis -aacplus -alsa -ao -dirac -doc -dssi -faad -gavl -graphics -jack -json -ladspa -lastfm -libsamplerate -mad -osc -portaudio -pulseaudio -soundtouch -speech -speex -theora -video -voaac -xml" 760 kB

Total: 34 packages (34 new), Size of downloads: 37,984 kB

The following keyword changes are necessary to proceed:
 (see "package.accept_keywords" in the portage(5) man page for more details)
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-duppy-0.4.2 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio[flac]
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-flac-0.1.0 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio[taglib]
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-taglib-0.2.0 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
=dev-ml/ocamlsdl-0.9.1 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio[vorbis]
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-vorbis-0.6.1 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-dtools-0.2.2 ~amd64
# required by dev-ml/ocaml-vorbis-0.6.1::proaudio
# required by media-radio/liquidsoap-1.0.1::proaudio[vorbis]
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-ogg-0.4.3 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
=dev-ml/gd4o-1.0_alpha5 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio[lame]
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-lame-0.3.1 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-magic-0.7.3 ~amd64
# required by dev-ml/ocaml-magic-0.7.3::proaudio
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
=sys-libs/libmagic-0_alpha ~amd64
# required by media-radio/liquidsoap (argument)
=media-radio/liquidsoap-1.0.1 ~amd64


=media-radio/liquidsoap-1.1.1 ~amd64
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-cry-0.2.2 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio[unicode]
# required by media-radio/liquidsoap (argument)
=dev-ml/camomile-0.8.4 ~amd64
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
=dev-ml/ocaml-mm-0.2.0 ~amd64

The following USE changes are necessary to proceed:
 (see "package.use" in the portage(5) man page for more details)
# required by media-radio/liquidsoap-1.0.1::proaudio
# required by media-radio/liquidsoap (argument)
>=dev-ml/ocamlsdl-0.9.1 truetype

Use --autounmask-write to write changes to config files (honoring
CONFIG_PROTECT). Carefully examine the list of proposed changes,
paying special attention to mask or keyword changes that may expose
experimental or unstable packages.

Добавляем перечисленные пакеты в /etc/portage/package.accetp_keywords и /etc/portage/package.use. В последнем добавляем поддержку taglib и mad:

media-radio/liquidsoap taglib mad

После этого установка запускается, на отсутствующие зависимости не ругается:

# emerge -av liquidsoap-1.1.1.ebuild

Но начинают вылазить ошибки ./configure :

checking for ocaml dtools module >= 0.3.0... configure: error: requires version >= 0.3.0 found 0.2.2.

Актуальные версии модулей можно посмотреть здесь: http://sourceforge.net/projects/savonet/files/

Фиксим:

# cd ../../dev-ml/ocaml-dtools/
# cp ocaml-dtools-0.2.2.ebuild ocaml-dtools-0.3.0.ebuild
# ebuild ocaml-dtools-0.3.0.ebuild manifest
# emerge -av ocaml-dtools-0.3.0.ebuild

Видим:

Calculating dependencies \
*** You are emerging a masked package. It is MUCH better to use
*** /etc/portage/package.* to accomplish this. See portage(5) man
*** page for details.
>>> Waiting 10 seconds before starting...
>>> (Control-C to abort)...
Continuing... in:  10 9 8 7 6 5 4 3 2 1
... done!
[ebuild     U ~] dev-ml/ocaml-dtools-0.3.0::proaudio [0.2.2::proaudio] USE="-doc" 0 kB

Total: 1 package (1 upgrade), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No]

Жмём "Y" и дело в шляпе. Продолжаем установку:

# cd ../../media-radio/liquidsoap/
# emerge -av liquidsoap-1.1.1.ebuild

Снова ошибка ./configure. Фиксим и продолжаем...

checking for ocaml mm module >= 0.2.1... configure: error: requires version >= 0.2.1 found 0.2.0.

# cd ../../dev-ml/ocaml-mm/   
# cp ocaml-mm-0.2.0.ebuild ocaml-mm-0.2.1.ebuild
# ebuild ocaml-mm-0.2.1.ebuild manifest 
# emerge -av ocaml-mm-0.2.1.ebuild  
# cd ../../media-radio/liquidsoap/
# emerge -av liquidsoap-1.1.1.ebuild

Далее configure ругается на не совсем новые версии разных ocaml модулей, но сборку не прерывает:

checking for ocaml taglib module >= 0.3.0... requires version >= 0.3.0 found 0.2.0.

# cd ../../dev-ml/ocaml-taglib/
# cp ocaml-taglib-0.2.0.ebuild ocaml-taglib-0.3.1.ebuild 
# ebuild ocaml-taglib-0.3.1.ebuild manifest
# emerge ocaml-taglib-0.3.1.ebuild
# cd ../../media-radio/liquidsoap/
# emerge liquidsoap-1.1.1.ebuild

Потом вылезло такое:

OCAMLOPT -o liquidsoap
/usr/lib64/ocaml/gd/libocamlgd.a(gdstubs.o): In function `ml_image_open_png':
(.text+0x422): undefined reference to `gdImageCreateFromPng'
/usr/lib64/ocaml/gd/libocamlgd.a(gdstubs.o): In function `ml_image_open_jpeg':
(.text+0x572): undefined reference to `gdImageCreateFromJpeg'
/usr/lib64/ocaml/gd/libocamlgd.a(gdstubs.o): In function `ml_save_png':
(.text+0x1c7b): undefined reference to `gdImagePng'
/usr/lib64/ocaml/gd/libocamlgd.a(gdstubs.o): In function `ml_save_jpeg':
(.text+0x1cd9): undefined reference to `gdImageJpeg'
/usr/lib64/ocaml/gd/libocamlgd.a(gdstubs.o): In function `ml_dump_png':
(.text+0x1d1b): undefined reference to `gdImagePngPtr'
/usr/lib64/ocaml/gd/libocamlgd.a(gdstubs.o): In function `ml_dump_jpeg':
(.text+0x1d66): undefined reference to `gdImageJpegPtr'
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
make[2]: *** [liquidsoap] Error 2
make[2]: Leaving directory `/var/tmp/portage/media-radio/liquidsoap-1.1.1/work/liquidsoap-1.1.1/src'
make[1]: *** [all-auto-ocaml-prog] Error 2
make[1]: Leaving directory `/var/tmp/portage/media-radio/liquidsoap-1.1.1/work/liquidsoap-1.1.1/src'
make: *** [all-subdirs] Error 2
 * ERROR: media-radio/liquidsoap-1.1.1::proaudio failed (compile phase):
 *   emake failed

А всё потому что gd был собран без поддержки jpeg и png:

[ebuild   R    ] media-libs/gd-2.0.35-r3:2  USE="zlib -fontconfig -jpeg -png -static-libs -truetype -xpm" 0 kB

Чтобы пофиксить, запускаем

# USE="jpeg png" emerge -av gd

или добавляем в /etc/portage/package.use  "media-libs/gd jpeg png" и пересобираем gd:

# emerge -av gd

Продолжаем установку и вуаля!

>>> Installing (1 of 1) media-radio/liquidsoap-1.1.1

>>> Recording media-radio/liquidsoap::proaudio in "world" favorites file...

 

Случилась такая ошибка. Причина была в том что в конце оида была ещё одна цифра.

Например, hrSystemProcesses, oid .1.3.6.1.2.1.25.1.6, но если запустить snmpwalk -v1 -c public <host> .1.3.6.1.2.1.25.1.6 то вывод будет с нулём в конце : iso.3.6.1.2.1.25.1.6.0 = Gauge32: 55

При сборке pecl расширения в gentoo может возникнуть ошибка:

libtool: Version mismatch error.  This is libtool 2.4.2, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2
libtool: and run autoconf again.

Решается так:

$ phpize 
$ aclocal && libtoolize --force && autoreconf
$ ./configure bbbb#again