2011年6月28日 星期二

[Linux] script to exclude CVS directory

# find sbin/ -not -name "Entries" -not -name "Root" -not -name "Repository" -not -name "CVS" -not -name "." -exec install -m 755 {} $(INSTALL_DIR)/sbin \;

To delete svn files with "!":


# svn st | grep ! | sed 's/!/svn --force del/g' > run.sh
edit run.sh and add "#!/bin/sh" in first line.
# ./run.sh

2011年6月27日 星期一

[Linux] Device/File system test script

#!/bin/ash

i=1
while true; do
        FILENAME=/mnt/hd/test.tmp
        BLOCKSIZE=1M
        BLOCKCOUNT=100

        echo "--- Write ($i) ---"
        dd if=/dev/zero of=$FILENAME bs=$BLOCKSIZE count=$BLOCKCOUNT conv=sync

        echo 3 > /proc/sys/vm/drop_caches
        echo 0 > /proc/sys/vm/drop_caches

        echo "--- Read ($i) ---"
        dd if=$FILENAME of=/dev/zero bs=$BLOCKSIZE count=$BLOCKCOUNT

        rm -f $FILENAME
        i=$(($i+1))
done