Now i’ve created a small subdomain for some interesting linux (and other system) dot files:
dot.cyber-tec.org
I hope someone need the stuff ;-)
Now i’ve created a small subdomain for some interesting linux (and other system) dot files:
dot.cyber-tec.org
I hope someone need the stuff ;-)
Ich verwende zur Zeit fuer kleinere sftp/ftp Geschichten lftp. Nun wollte ich “schnell” den upload limitieren damit das Surfen nicht zur Qual wird hierfuer fuehrt man einfach in lftp folgendes aus:
set limit-rate <download-rate>:<upload-rate>
Everybody who loves bash are welcome to use my bashrc :)
#--------------------------------------------------------------------
# $Id: bashrc,v 1.7 2007/10/08 21:33:00 drscream Exp $
# Copyright 2007 Frubar Network (drscream@frubar.net)
#--------------------------------------------------------------------
##########################################################################
# Test for an interactive shell.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
##########################################################################
# functions
function sshs {
ssh $@ -t screen
}
function root {
sudo su -c \
'/bin/bash --rcfile /home/${SUDO_USER}/.bashrc'
}
function runfortune {
if [[ $(which fortune 2>/dev/null) ]]; then
echo; fortune -s; echo
fi
}
# aliases
alias ls='ls --color=auto'
alias ll='ls -l'
alias la='ls -la'
alias grep='grep --color=auto'
alias kwrite='kwrite 2>/dev/null &'
alias cal='cal -m'
alias screen='screen -RD'
#alias ssh='sshs'
# dir colors
if [[ -f ${HOME}/.dir_colors ]]; then
eval $(dircolors -b ${HOME}/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]]; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
# change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
;;
screen)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
;;
esac
# set default PS1 PS2
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[0;31m\][\u@\h]\[\033[0m\]:\[\033[0;34m\]\w #\[\033[0m\] '
PS2='root %> '
else
PS1='\[\033[0;33m\][\u@\h]\[\033[0m\] \[\033[0;32m\]\w\[\033[0m\]\n % '
PS2='%> '
runfortune
fi
# nice env variables
VISUAL=/usr/bin/vim
EDITOR=${VISUAL}
PAGER=/usr/bin/less
LESSSECURE=1
LANG=en_US.utf8
LC_ALL=en_US.utf8
SSL_CERT_DIR=${HOME}/.certs/
PATH=${HOME}/.bin:$PATH
HOST=$(hostname | sed 's/[.].*//g')
export PROMPT_COMMAND PS1 PS2 VISUAL EDITOR PAGER LANG LC_ALL PATH LESSSECURE SSL_CERT_DIR
# keychain check and use
if [[ -x $(which keychain 2>/dev/null) ]]; then
if [[ -f ${HOME}/.ssh/id_rsa ]]; then
keychain --host ${HOST} -q ~/.ssh/id_rsa
. ~/.keychain/${HOST}-sh
fi
fi
# load special file if exists
if [[ -f ${HOME}/.doc.env/etc/bash/${HOST}.bashrc ]]; then
source ${HOME}/.doc.env/etc/bash/${HOST}.bashrc
fi
Ich verwend jetzt schon seit einigen Monate CenterIM, jedoch hatte ich immer das Problem das es mir Sonderzeichen (wie ö/ü/ä/ß) nicht angezeigt oder sogar ganze Woerter verschluckt wurden.
Zum Beispiel:
‘Österreich’ => ‘terreich’
Das erleichtert natuerlich nicht gerade das Lesen von Chatnachrichten, nun das Problem laesst sich jedoch recht einfach loesen.
Man hat bei der locale z.B. UTF-8 Support eingestellt (wie ich auch), leider sendet ICQ aber ISO-Bullshit.
Nun erst einmal rausfinden welche locale man eingestellt hat:
% locale LANG=en_US.utf8 LC_ALL=en_US.utf8
Nun wechselt man in die CenterIM config options dort gibt es die Einstellmoeglichkeiten Remote charset und Local charset, tja und die stellt man jetzt einfach nach seinen wuenschen ein. Bei mir waere das:
Tada und schon funktionieren bei mir die Umlaute :-)
If you have a document thats full of spaces or empty lines, edit it with Vim:
Eliminate empty lines:
:v/\S/d
Eliminate spaces at the beginning of each line:
:%s/^\s\+//
Eliminate spaces at the end of the each line:
:%s/\s\+$//
I love screen, so here is my ~/.screenrc file:
#--------------------------------------------------------------------
# $Id: screenrc,v 1.7 2007/10/08 19:01:09 drscream Exp $
# Copyright 2007 Frubar Network (drscream@frubar.net)
#--------------------------------------------------------------------
# DEFAULT
shell bash
autodetach on
defutf8 on
deflogin off
startup_message off
nethack on
activity "activity in %n (%t)"
bell_msg "bell in %n (%t)"
defhstatus "screen: ^En (^Et)"
shelltitle "$ |sh:"
vbell on
vbell_msg "WHAT ??!!"
vbellwait 1
msgminwait 1
msgwait 3
#hardcopy_append on
#hardcopydir ~/.screen
windowlist title " Num%+3=| Fl%+3=| Name"
windowlist string " %3n%+3=| %f%+3=| %t"
zombie ^D^C
escape ^Aa
termcapinfo xterm|xterm-256color|xterms|xs|rxvt ti@:te@
#idle 600 blanker
#blankerprg nice -n 19 cmatrix -abu9
# BINDINGS
bind ^r source "${HOME}/.screenrc"
bind ^e escape ^Xx
bind ^y escape ^Aa
bind ^x lockscreen
bind o copy
bind p paste .
bind . number
bind l lastmsg
bind w windowlist -b
bind r resize
bind s select
bind > split
bind < remove
bind ^f focus down
bind = resize =
bind + resize +5
bind - resize -5
bind ~ resize max
# STATUSPANEL
hardstatus alwayslastline
hardstatus string '%{= kY}[ %{R}%H %{Y}][ %{g}load[%l] %{Y}][ %{B}%d/%m/%Y %c %{Y}][ %{r}%=%?%-w%?(%n%f %t)%?%+w%? %{Y}]'
Es gibt sicher einiges effektivere und bessere Scripte um ein System und MySQL Backup zu machen. Das ist jetzt auch nur die erste Version des ganzen und evtl. kann es jemand gebrauchen :)
#####################################################################
# srv-backup.sh - backup the system and the databases #
# @author: drscream@cyber-tec.org #
# @version: Thu Oct 4 11:35:39 CEST 2007 #
#####################################################################
# CONFIGURATION
#####################################################################
# crontab example:
# 21 4 * * * /opt/av-srv/av-srv-backup.sh mysql
# 2 3 1,15 * * /opt/av-srv/av-srv-backup.sh system
# 2 4 * * * /opt/av-srv/av-srv-backup.sh webroot
# 3 6 * * * /opt/av-srv/av-srv-backup.sh pgsql
## log information ##################################################
log_file="/local/backup/backup.log"
datetime=$(date +%Y%m%d-%H%M%S)
fqdn=$(hostname -f)
## select what to backup ############################################
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => asdf.tar.bz2: file to save the backup
# => sysdir.txt: text file with the directories to backup
# => rsync: rsync is set the file will rsynced to the backupsrv
system=(1 '/local/backup/system' 'system.$fqdn.$datetime.tar.gz' './systemdir.txt' 'rsync')
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => asdf.tar.bz2: file to save the backup
# => /web: directory to backup
# => rsync: rsync is set the file will rsynced to the backupsrv
webroot=(1 '/local/backup/webroot' 'web.$fqdn.$datetime.tar.gz' '/web' 'rsync')
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => user: sql user (root)
# => password: sql password
# => rsync: rsync is set the file will rsynced to the backupsrv
mysql=(1 '/local/backup/mysql' 'root' 'qwe123' 'rsync')
# => 0/1: deactivate or activate the backup
# => /srv/xxx: path to save the backup
# => asdf.tar.bz2: file to save the backup
# => user: sql user (root)
# => rsync: rsync is set the file will rsynced to the backupsrv
pgsql=(0 '/local/backup/pgsql' 'pgsql.$fqdn.$datetime.sql.gz' 'postgres' 'rsync')
# => 0/1: rsync to the specified server
# => username: username for rsync
# => hostname: specified backup server host
# => /path: path to save the backup ($fqdn is added)
rsync=(1 'username' 'hostname' '/backup')
rsync_args="--archive"
## delete the files after days #################################
delete_files=20
## global variables #################################################
export LANG="en_US.utf8"
PARAM=$1
# FUNCTIONS
#####################################################################
function delete() {
find $1 -type f -mtime +$delete_files | xargs rm 2>/dev/null
}
function log() {
echo $1 >> $log_file
}
function backuprsync() {
if [[ ${rsync[0]} == 1 && ${1} == "rsync" ]]; then
log "($datetime) rsync to server ---------------------------"
rsync ${rsync_args} $2 ${rsync[1]}@${rsync[2]}:${rsync[3]}/${fqdn} >> $log_file
log "end rsync to server -----------------------------------"
fi
}
# MAIN
#####################################################################
## system ###########################################################
if [[ ${system[0]} == 1 && ${PARAM} == "system" ]]; then
# cleanup system backup
delete ${system[1]}
# start system backup
log "($datetime) systembackup: ---------------------------------"
log "backup following files:"
dir_backup=$(cat ${system[3]})
log "$dir_backup"
# compress the files
cd /
tar cvpzf "${system[1]}/${system[2]}" $dir_backup
# rsync if it is set
backuprsync ${system[4]} ${system[1]}/${system[2]}
log "end systembackup ------------------------------------------"
fi
## webroot ##########################################################
if [[ ${webroot[0]} == 1 && ${PARAM} == "webroot" ]]; then
# cleanup webroot backup
delete ${webroot[1]}
# start webroot backup
log "($datetime) webrootbackup: --------------------------------"
log "backup following dir:"
dir_backup=$(ls -la ${webroot[3]})
log "$dir_backup"
# compress the files
cd ${webroot[3]}
tar cvpzf "${webroot[1]}/${webroot[2]}" *
# rsync if it is set
backuprsync ${webroot[4]} ${webroot[1]}/${webroot[2]}
log "end webrootbackup -----------------------------------------"
fi
## mysql ############################################################
if [[ ${mysql[0]} == 1 && ${PARAM} == "mysql" ]]; then
# cleanup mysql backup
delete ${mysql[1]}
# start mysql backup
log "($datetime) mysqlbackup -----------------------------------"
mysqlshow -u ${mysql[2]} --password=${mysql[3]} | tr -d '|' | tr -d '+' | tr -d ' ' | tr -d '-' > /tmp/sql-backup-list.tmp
list=/tmp/sql-backup-list.tmp
ig=3
xr_lines=$(wc -l $list | awk '{ print $1 }')
while [ "$ig" -le $xr_lines ]; do
ig=$(expr $ig + 1)
item=$(awk "NR == $ig {print}" $list)
mysqldump --add-drop-table --allow-keywords -q -a -c -u ${mysql[2]} --password=${mysql[3]} $item | gzip > ${mysql[1]}/$item.sql.gz
echo $item >> $dir_backup
done
# Remove a temp file
rm -f /tmp/sql-backup-list.tmp
# rsync if it is set
backuprsync ${mysql[4]} ${mysql[1]}
log "end mysqlbackup -------------------------------------------"
fi
## pgsql ############################################################
if [[ ${pgsql[0]} == 1 && ${PARAM} == "pgsql" ]]; then
# cleanup pgsql backup
delete ${pgsql[1]}
# start pgsql backup
log "($datetime) pgsqlbackup -----------------------------------"
pg_dumpall -U${pgsql[3]} | gzip > "${pgsql[1]}/${pgsql[2]}.gz"
# rsync if it is set
backuprsync ${pgsql[4]} ${pgsql[1]}
log "end pgsqlbackup -------------------------------------------"
fi
Beim Import einer 500 MB SQL-Datei in eine MySQL Datenbank ist der folgende Fehler aufgetreten:
ERROR 1114 (HY000) at line 582: The table 'company' is full
Das bedeutet, dass die InnoDB Daten-Dateien voll sind und nicht automatisch, bzw. nur bis zu einem bestimmten Wert erweitert werden (autoextend).
Loesung: In der MySQL-Config-Datei “my.cnf” befindet sich die folgende Einstellung fuer InnoDB Daten-Dateien:
innodb_data_file_path = ibdata1:10M:autoextend:max:128M
Es bedeutet, dass eine Daten-Datei 10MB gross ist und die Tabelle / Datenbank bis maximal 128MB erweitert wird. Das kann man aendern in:
innodb_data_file_path = ibdata1:100M:autoextend
Jetzt ist eine Daten-Datei 100MB gross und es gibt keine Beschraenkung beim automatischen Erweitern.
Es kann ja mal passieren das man das root – Passwort fuer den MySQL Server vergisst, es sollte zwar nicht passieren aber es kann ;) Es gibt eine recht einfach moeglichkeit dieses wieder zurueckzusetzten.Man startet den MySQL – Daemon einfach mit –skip-grant-tables. Stellt dann ueber die Shell eine Verbindung zum MySQL – Daemon her:
shell> mysql -u root
Nun kann man ganz einfach das Passwort neu vergeben:
mysql> UPDATE mysql.user SET Password=PASSWORD('NeuesPasswort') WHERE User='root';
mysql> FLUSH PRIVILEGES;
Tada und schon hat der root ein neues MySQL Passwort :)
Last weekend I have to much time so I started testing some new / old bsd and linux distributions. At this point I tested DesktopBSD and I like it.![]()
I think it’s a good distribution for peoples which want a system thats works. If you are tinker use FreeBSD instead ;)