in /etc/crontab :

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

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

/usr/local/bin/check_la.sh :

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

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

fi

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

/usr/local/bin/stat.sh :

#!/bin/sh

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


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

 

Original from http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade

upgrade 1.3.2(Ubuntu) to 2.4.2(Gentoo)

copy distrib redmine to new server and unpack to new folder

do not copy old configs

copy files folder

copy plugins folder

adjust database.yml according to manual

dump db with no parameters

# mysqldump redmine_database --result-file=/root/redmine_database.sql

create new database:

mysql> CREATE DATABASE `redmine_new_db` CHARACTER SET utf8 COLLATE utf8_general_ci;

restore db with no parameters

# mysql redmine_new_db < /root/redmine_database.sql

cd to new redmine folder (/var/lib/redmine)

# rake generate_secret_token

# rake db:migrate RAILS_ENV=production

if got error :

==  CreateChangesetParents: migrating =========================================
-- create_table(:changeset_parents, {:id=>false})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'changeset_parents' already exists: CREATE TABLE `changese'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

do

# mysql -e 'drop table `changeset_parents`' redmine2new

then migration ok

 

 

Проблема: В журнале постоянно сообщения вида:

Connection from UDP: [192.168.11.1]:11227->[192.168.11.64]:161
Received SNMP packet(s) from UDP: [192.168.11.1]:11227->[192.168.11.64]:161

Решение: Чтобы они не писались в /etc/rc.conf:

snmpd_flags="-a -LF 0-5 /var/log/snmpd.log"

Создаем такого содержания файл /usr/local/scripts/apcupsd-stats :

#!/usr/bin/perl -w
# Copyright (C) 2009  Glen Pitt-Pladdy
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
#
#
# See: http://www.pitt-pladdy.com/blog/_20100320-215243_0000_apcupsd_stats_on_Cacti_via_SNMP_/
#


open AC, "/usr/local/sbin/apcaccess status localhost |"
	or die "FATAL: can't run \"/usr/local/sbin/apcaccess\": $!\n";
while ( defined ( $line =  ) ) {
	chomp $line;
	if ( $line !~ /^(\w+)\s*:\s*([^\s]+)/ ) { next; }
	$field{$1} = $2;
}
close AC;


print "$field{LINEV}\n";
print "$field{OUTPUTV}\n";
print "$field{LOTRANS}\n";
print "$field{HITRANS}\n";
print "$field{BATTV}\n";
print "$field{NOMBATTV}\n";
print "$field{BCHARGE}\n";
print "$field{TIMELEFT}\n";
print "$field{LOADPCT}\n";
print "$field{LINEFREQ}\n";
#print "$field{ITEMP}\n";
#print ''.($field{'NOMPOWER'}*$field{'LOADPCT'}/100)."\n";
#print "$field{NOMPOWER}\n";
#if ( $field{'STATUS'} eq 'ONLINE' ) {
#	print "100\n0\n";
#} else {
#	print "0\n100\n";
#}

Некоторые модели не показывают температуру, как, например 420, поӕтому строку с температурой комментируем :-)

#print "$field{ITEMP}\n";

Делаем скрипт исполняемым