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 ;-)
Vapier vom Gentoo Dev Team bietet in seiner Patchsammlung fuer die coreutils den 001_all_coreutils-gen-progress-bar.patch Patch an.
Durch das einspielen des Patches erhalten wir einen tollen Fortschrittsbalken bei den Befehlen cp und mv:
cp -g /mnt/etcbackup.zip ~/temp etcbackup.zip | 1% | 175 MiB | 122 KiB/s | ETA 00:24.03
Zu finden ist die ganze Patchsammlung hier:
http://dev.gentoo.org/~vapier/dist/coreutils-6.9-patches-1.2.tar.bz2
Was etwas unklar ist das Gentoo direkt beim Ebuild fuer die coreutils einige Patches verwendet jedoch gerade diesen loescht!
hihi, doch glatt vergessen wo ich das gefunden habe:
geekosphere.org
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 hab mir gedacht eigentlich ist es doch toll ein paar mehr Statusinformationen in den vielen ttys wo man hat anzuzeigen. Also habe ich meine /etc/inittab etwas erweitert und zwar um folgende Zeilen:
# show a clock
9:2345:respawn:/usr/bin/nice -n 19 -- /usr/bin/klock >&/dev/tty9 </dev/tty9
# show the system load
10:2345:respawn:/usr/bin/nice -n 19 -- /usr/bin/tload -d 5 /dev/tty10
# show /var/log/allmessages with less
11:2345:respawn:/usr/bin/nice -n 19 -- /usr/bin/env LESSSECURE=1 /usr/bin/less -iMRS +F /var/log/messages >&/dev/tty11 </dev/tty11
# show htop
12:2345:respawn:/usr/bin/env HOME=/root /usr/bin/htop >&/dev/tty12 </dev/tty12
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\+$//
Hi there,
i have written a small client for sau and frupic, it’s only a small bash script. Have a look at it:
#!/bin/bash
#--------------------------------------------------------------------
# $Id: frucln,v 1.7 2007/10/08 18:01:09 drscream Exp $
# Copyright 2007 Frubar Network (drscream@frubar.net)
#--------------------------------------------------------------------
# FUNCTIONS
function pause() {
i=0;
echo -n "- pause: "
while [ $i -le $count ]; do
echo -n "."
sleep 1
i=$[$i+1]
done
echo
}
# MAIN
echo "[ frucln - creative coding ]"
# $1: sau
# frupic
case $1 in
"sau")
if [[ $2 > 0 ]]; then
count=$2
pause $count
fi
osys=$(uname)
if [[ ${osys} == "Linux" ]]; then
$(import -window root -pause 0 -quality 100 /tmp/sau.tmp.png)
elif [[ ${osys} == "Darwin" ]]; then
$(screencapture -m /tmp/sau.tmp.png)
else
echo "- Error: Operating System not found"
exit
fi
if [[ -f /tmp/sau.tmp.png ]]; then
id=$(curl -s -F userfile=@/tmp/sau.tmp.png -F "shooter=$(whoami)" "http://sau.frubar.net/")
if [[ $id > 0 ]]; then
echo "- Successfull: SaU"
echo " http://sau.frubar.net/${id}"
else
echo "- Error: Upload failed"
fi
$(rm /tmp/sau.tmp.png)
else
echo "- Error: SaU file doesn't exists"
fi
;;
"frupic")
all=$(echo $2 | grep \*)
if [[ $all ]]; then
for f in $all; do
id=$(curl -s -F userfile=@$f -F "shooter=$(whoami)" "http://frupic.frubar.net/")
if [[ $id > 0 ]]; then
echo "- Successfull: frupic"
echo " http://frupic.frubar.net/${id}"
else
echo "- Error: Upload failed ($f)"
fi
done
exit
elif [[ $2 ]]; then
id=$(curl -s -F userfile=@$2 -F "shooter=$(whoami)" "http://frupic.frubar.net/")
if [[ $id < 0 ]]; then
echo "- Successfull: frupic"
echo " http://frupic.frubar.net/${id}"
else
echo "- Error: Upload failed"
fi
exit
else
echo "- Error: No Parameter given"
fi
;;
*)
echo "frucln:"
echo " - use: frucln "
;;
esac
echo $args
#curl -s -F userfile=@CIMG0885.JPG -F "shooter=`whoami`" "http://frupic.frubar.net/"
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