Here are some things I put in ~/.bashrc or /etc/bash.bashrc to make my life easier:
# When using bash, I use ctrl+r a lot to find commands I executed recently.
# I found that I remember my commands for much longer than bash does,
# so I increased my bash's memory:
export HISTFILESIZE=3000 # the bash history should save 3000 commands
export HISTCONTROL=ignoredups # don't put duplicate lines in the history.
export HISTCONTROL=ignoreboth # ignore same sucessive entries.
# (from http://www.novell.com/coolsolutions/tools/17142.html)
# I like to have a colour prompt with my user, the machine I'm on and the full
# path. Its a bit long so I put it on 2 lines.
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]>\n\$ '
# enable bzr command auto completion
. /opt/bzr/bzr.current/contrib/bash/bzr.simple
# bzr aliasses
alias bt='./bzr --no-plugins selftest'
alias bd='bzr diff'
alias bl='bzr log'
alias bp='bzr pull -v |less'
alias bm='bzr missing |less'
alias bs='bzr status'
# bzr functions, which cant be done by alias or bzr's alias
bh(){
#the $@ inserts all the parameters you pass in
bzr help "$@" |less
}
bcd(){
bzr cdiff "$@" | less -R
}
Saturday, 11 October 2008
Sunday, 5 October 2008
Super cool startup script for linux
I recently had to get a startup script going which works on Ubuntu and Sles for loggerhead. I came up with these install instructions and following simple but super cool init script. Note that this should work for basically any linux daemon, you just need to rename the script (loggerheadd) and change the script a little.
Here follows the script (the indentation is a bit messed up by blogspot)
- Copy loggerheadd to /etc/init.d
- Edit the file to configure it.
- Register the service:
cd /etc/init.d
- on Sysvinit based systems like Centos or SuSE run:
chkconfig --add loggerheadd
Here follows the script (the indentation is a bit messed up by blogspot)
#!/bin/sh
### BEGIN INIT INFO
# Required-Start: $local_fs $remote_fs $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Loggerhead
# Description: Manage Loggerhead (a web viewer for projects in bazaar)
### END INIT INFO
# Configure this please: #
LOGGERHEAD_PATH=/opt/loggerhead
LOG_FOLDER=/var/log/loggerhead
LOG_FILE=$LOG_FOLDER/loggerheadd.log
PREFIX=/loggerhead
PORT=8080
# You can add additional options to serve-branches here:
START_CMD="$LOGGERHEAD_PATH/serve-branches --prefix=$PREFIX --log-folder=$LOG_FOLDER --port=$PORT /var/lib/gforge/bzrroot/"
#
# main part
#
case "$1" in
start)
python $START_CMD > $LOG_FILE 2>&1 &
echo "Started loggerhead. (See $LOG_FOLDER for details.)"
;;
stop)
pkill -f "$START_CMD"
;;
status)
proccess=`pgrep -fl "$START_CMD"`
echo "$proccess"
netstat -anp |grep -e ":$PORT"
if [ -z "$proccess" ]; then
echo "Loggerhead is not running."
else
echo "Loggerhead is running."
fi
;;
*)
echo "Usage: loggerheadd { start | stop | status }"
exit 1
esac
Wednesday, 1 October 2008
Maximum file sizes on differrent file systems
I was looking up the maximum file size on a file system for a friend, and I realised I didn't even know this stuff. Here is a couple:
FAT32: 4 GiB
NTFS: 16 EiB
ext2 and ext3: 16 GiB to 2 TiB (see this note about max range)
ext4: 1 EiB
ReiserFS: 8 TiB
HFS plus (used by Apple's Mac OS X): 8 EiB
http://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits
FAT32: 4 GiB
NTFS: 16 EiB
ext2 and ext3: 16 GiB to 2 TiB (see this note about max range)
ext4: 1 EiB
ReiserFS: 8 TiB
HFS plus (used by Apple's Mac OS X): 8 EiB
http://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits
Subscribe to:
Posts (Atom)