webfaction中django问题

webfaction中django配置,通用的没什么可讲的,只是有几点需要注意的. webfaction的web目录不能是一个链接,必须是一个实际的目录. 修改了除模板,media以外的任意文件,都要重启apache。 为了方便,把几个bin目录加到PATH里 把这一行加入~/.bashrc ...

November 26, 2009 · notsobad

让你的linux释放一些不必要的空间

系统磁盘空间占用100%会对系统产生很严重的影响。这是系统服务或者其他的程序都不能够记录日志或者不能够在/var目录保存数据。这些程序一旦不能够保存他们需要的数据,就会自动退出或者直接崩溃。为了避免这种情况发生,ext2和ext3文件系统一般会预留5%的磁盘空间来让root进程使用。这本来是一个挺好的主义,但是5%有时候会显得太大了。例如:500G的硬盘就会预留25G的空间了。而且还有不需要预留空间的磁盘,例如:/home目录。 可喜的是5%这个分配额不是硬编码到文件系统中的。这个分配额可以在不需要移动已有数据的情况下很方便的修改。Tune2fs能够被用来修改ext2或ext3系统的这个分配额。这个工具非常强大,可以修改很多文件系统相关的信息。但是我们这里用到的只有两个- m和-r参数。-m参数用来改变文件系统预留的百分比。-r参数可以指定预留的块数(文件系统是把整个磁盘分成了固定大小的块来管理的)。 ...

November 24, 2009 · notsobad

ssh的密钥登录

ssh登录输入密码很麻烦,以前我是写一个expect脚本来登录,不过那比较土,安全的做法是用公钥、私钥的方法,参考这篇文章 1. On the client run the following commands: $ mkdir -p $HOME/.ssh $ chmod 0700 $HOME/.ssh $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P '' This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key). 2. Copy $HOME/.ssh/id_dsa.pub to the server. 3. On the server run the following commands: $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2 $ chmod 0600 $HOME/.ssh/authorized_keys2 Depending on the version of OpenSSH the following commands may also be required: $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys $ chmod 0600 $HOME/.ssh/authorized_keys An alternative is to create a link from authorized_keys2 to authorized_keys: $ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys 4. On the client test the results by ssh'ing to the server: $ ssh -i $HOME/.ssh/id_dsa server 5. (Optional) Add the following $HOME/.ssh/config on the client: Host server IdentityFile ~/.ssh/id_dsa This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.

November 16, 2009 · notsobad

webfaction中使用crontab与安装python包

继续感冒中…… 实在睡不着了,把我的这个脚本移到webfaction,放到crontab里了。 设置PYTHONPATH和PATH环境变量 [notsobad@web108 ~]$ cat .bashrc # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions export PYTHONPATH=$PYTHONPATH:$HOME/script/python-lib export PATH=$PATH:$HOME/script/bin 然后就可以使用easy_install了,我要安装feedparser: easy_install --install-dir=$HOME/script/python-lib --script-dir=$HOME/script/bin feedparser crontab的使用: crontab -e 直接编辑即可,注意crontab使用的环境变量和登录用户使用的是不一样的,要使用自定义的pythonpath的话,需要自己指定 ...

November 8, 2009 · notsobad