Skip to content

Instantly share code, notes, and snippets.

@shellexy
Created November 26, 2011 11:17
Show Gist options
  • Save shellexy/1395472 to your computer and use it in GitHub Desktop.
Save shellexy/1395472 to your computer and use it in GitHub Desktop.
苏酱要的 chromium.sh
#!/bin/bash
# ~/bin/chromium.sh
# 使用内存文件系统加速 chromium 运行
# 启动前和关闭后同步文件
CMD="chromium"
RAM_CACHE_DIR="/dev/shm/$USER-chrome-cache/"
DISK_CACHE_DIR="$HOME/.cache/chromium/"
test -a ~/.config/chromium/SingletonSocket || {
rsync -av --delete $DISK_CACHE_DIR $RAM_CACHE_DIR
$CMD "$@" --disk-cache-dir="$RAM_CACHE_DIR"
rsync -av --delete $RAM_CACHE_DIR $DISK_CACHE_DIR
exit 0
}
exec $CMD "$@" --disk-cache-dir="$RAM_CACHE_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment