Configure maildroprc

# /etc/courier/maildroprc
 
# Our shell
SHELL="/bin/bash"
 
# The default path
DEFAULT = "$HOME/Maildir"
 
# Our log file
logfile "/var/log/maildrop"
 
# Our verbosity in the log file
VERBOSE="5"
 
# This get's added above each entry in the log file.
# It's just a visual aid.
log "------------------------"
 
# If the Spam-Flag is YES, sort to Junk folder
if ( /^X-Spam-Flag: YES/)
{
       to $DEFAULT/.SPAM/
}
 
if ( /^Subject: new_order/)
{
        `/data/scripts/processOrder.sh`
        to $DEFAULT/.ORDER
}
 
# FILES
# processOrder.sh - http://www.panticz.de/node/155

instalPicasa.sh

#!/bin/bash
 
sudo su
 
echo "deb http://dl.google.com/linux/deb/ stable non-free" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get install picasa 

BASH

# and
if [ "$foo" == "a" ] && [ "$bar" == "b" ]; then
 
 # or
if [ "$foo" == "x" ] || [ "$bar" == "y" ]; then
 
# both
if ( [ "$a" == "a" ] || [ "$a" == "b" ] ) && ( [ "$b" == "c" ] ); then
 
 
# enable color output systemwide for ls and grep
cat <<EOF>> /etc/profile.d/alias.sh
alias ls='ls --color=auto'
alias grep='grep --color=auto'
EOF
 
# get exitcode prevoius command
${PIPESTATUS[0]}
 
# redirect stdout AND stderr to file
COMMAND &> file.out
 
# sequence
echo {,my-}host{1,{3..5},9,10}
echo $(seq 1 4)
 
# for loop
START=1
END=10
for ((i=START; i<=END; i++)); do
    e

Check file name and set rights

#!/bin/bash
 
change_rights() {
	for i in $(find $1 -perm 700); do
		echo "set rights for $i"
		chmod a+rw $i
	done
 
	for i in $(find $1 -perm 600); do
		echo "set rights for $i"
		chmod a+rw $i
	done
}
 
change_name() {
	for i in $(find $1 -name "*.JPG"); do
		echo "rename $i ${i//.JPG/.jpg}"
		mv "$i" "${i//.JPG/.jpg}"
	done
}
 
for DIR in /data/bilder/300dpi /data/bilder/700dpi; do
	change_rights $DIR
	change_name $DIR
done

Create XEN Zimbra domain (Zimbra Collaboration Suite)

#!/bin/bash
 
wget http://www.panticz.de/sites/default/files/ubuntu-2.6.22-14-xen.i386-kernel.tar.bz2 -P /tmp
tar -xjPf /tmp/ubuntu-2.6.22-14-xen.i386-kernel.tar.bz2
 
DOMAIN_NAME=mx
 
xen-create-image --hostname=$DOMAIN_NAME --ip=192.168.1.231 --gateway=192.168.1.5 --netmask=255.255.255.0 \
--dir=/home/xen --dist=gutsy --mirror=http://archive.ubuntu.com/ubuntu/ --arch=i386 \
--size=8Gb --memory=1Gb --swap=1Gb \
--kernel=/boot/vmlinuz-2.6.22-14-xen.i386 --initrd=/boot/initrd.img-2.6.22-14-xen.i386
 
cp /etc/xen/$DOMAIN_NAME.cfg  /etc/xen/$DOMAIN_NAME.cfg.org
sed -i 's|file:|tap:aio

Create XEN Scalix domain

#!/bin/bash
 
# !!!

HTML examples

<!-- Text scroll -->
<marquee scrollamount="2">Then your text</marquee></code>

VirtualBox network over host interface

#!/bin/bash
 
# install bridge utils
apt-get install bridge-utils
 
# create bridge
cat <<EOF>> /etc/network/interfaces
auto br0
iface br0 inet dhcp
        bridge_ports eth0
        bridge_fd 2.5
EOF
 
# restart network
/etc/init.d/networking restart
 
# create an interface for a user
VBoxAddIF vbox0 $USERNAME br0
 
 
# Links
# http://wiki.ubuntuusers.de/VirtualBox
# http://wiki.debian.org/VirtualBox

Send HTML mail from command line (Newsletter)

#!/bin/bash
 
# http://www.panticz.de/Send-email-from-console
 
INPUT=./adr_uniq.txt
CONTENT=./nl_de.html
SUBJECT="YOUR_SUBJECT"
LOG=./nl_de_$(date -I).log
 
# send 
for i in $(cat $INPUT); do
   mail -a 'Content-type: text/html;' -s "$SUBJECT" "$i" < $CONTENT
   echo "$i - $?" | tee -a $LOG
done

Install Ubuntu Hardy from HDD

#!/bin/bash
 
# download netboot image
wget http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/netboot.tar.gz -P /tmp
 
# extract and copy install files
tar xzf /tmp/netboot.tar.gz -C /tmp
mkdir /boot/ubuntu
cp /tmp/ubuntu-installer/amd64/initrd.gz /boot/ubuntu/
cp /tmp/ubuntu-installer/amd64/linux /boot/ubuntu/
 
# create GRUB menu entry
cat <<EOF> /etc/grub.d/49_ubuntu
#!/bin/sh
exec tail -n +4 $0
 
menuentry "Network Ubuntu install" {
    root (hd0,0)
    kernel /boot/ubuntu/linux
    initrd /boot/ubuntu/initrd.gz
}
EOF
chmod 
Syndicate content