Jojo is resting
2010
my web space
No need for complex, unclear, and clumsy programs like Capistrano.
Use Fabric, here is a short exmple, which automates the archive process of users’ directories:
# install the Python library easy_install fabric # create a file called "fabfile" # it will be used from the "fab" command # add the following tasks in "fabfile":
from fabric.api import * env.hosts = ["main"] env.user = "root" def archive_home(): with cd("/tmp"): run("zip -rq home_`date +%Y:%m:%d-%H:%M`.zip /home") def archive_download(): import os os.system("scp %s:/tmp/home_*.zip /home/su/archive" % env.hosts[0]) def archive_remove(): run("rm /tmp/home_*.zip")
In addition you can use decorators to specify different hosts for different tasks.
More about the “fab” command:
fab --help
Usage: fab [options] (command) [:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ...
Options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-l, --list print list of possible commands and exit
-d COMMAND, --display=COMMAND
print detailed info about a given command and exit
-r, --reject-unknown-hosts
reject unknown hosts
-D, --disable-known-hosts
do not load user known_hosts file
-u USER, --user=USER username to use when connecting to remote hosts
-p PASSWORD, --password=PASSWORD
password for use with authentication and/or sudo
-H HOSTS, --hosts=HOSTS
comma-separated list of hosts to operate on
-R ROLES, --roles=ROLES
comma-separated list of roles to operate on
-i KEY_FILENAME path to SSH private key file. May be repeated.
-f FABFILE, --fabfile=FABFILE
name of fabfile to load, e.g. 'fabfile.py' or
'../other.py'
-w, --warn-only warn, instead of abort, when commands fail
-s SHELL, --shell=SHELL
specify a new shell, defaults to '/bin/bash -l -c'
-c RCFILE, --config=RCFILE
specify location of config file to use
--hide=LEVELS comma-separated list of output levels to hide
--show=LEVELS comma-separated list of output levels to showCigarettes can expose you to a great danger due to a little know behavioural feature.
Imagine the way that each cigarette has – long, boring, lonely. So it’s very natural for a cigarette to become talkative once you free it from the box. And here comes the catch – you begin to socialize with the cigarettes. Which in turn makes you addicted, but even worse – this habit can peril your cosy existence to the point this person has reached:
If it happens that only root (or no one) can use key authentication, most probably the permissions are wrong. Check the following permissions:
ls -ld ~/.ssh | awk '{print $1}' # should return drwx------ # otherwise: chmod 0700 ~/.ssh
Enable the localhost interface:
/sbin/ifconfig lo up
apt-get remove --purge gitk gitosis git-gui git-core
apt-get install mercurial
I am sick of mkdir dir_name; cd dir_name;
The solution (put this function in “.bashrc” or whatever shell config file you use):
_mkcd () { mkdir -p $1 cd $1 } # usage: _mkcd /tmp/dir_1/dir_2 # pwd will show: /tmp/dir_1/dir_2
Why Assembla free plan:
P.S. If you are like me - spitting on GIT on a daily basis - Mercurial is included in the other plans.
>>>from nltk.corpus import wordnet as wn >>>wn.synsets('Christmas')[0].lemma_names ['Christmas', 'Christmastide', 'Christmastime', 'Yule', 'Yuletide', 'Noel']
Comments