flushing
[myplc.git] / bashrc
1 # -*-sh-*-
2 # $Id$
3 # $URL$
4 # this file defines a few convenience bash shorthands for managing myplc nodes
5 # it is installed in /usr/share/myplc/aliases
6 # you might wish to use it in your own bash startup files (.profile/.bashrc)
7
8 ssh_options="-o BatchMode=yes -o StrictHostKeyChecking=no"
9
10 function node_key () {
11     key="$1"; shift
12     hostname="$1"; shift
13     echo Running "$@" on root@"$hostname"
14     ssh $ssh_options -i "$key" "root@$hostname" "$@"
15 }
16
17 function nodes_key () {
18     key="$1"; shift
19     filename="$1"; shift
20     for hostname in $(grep -v '#' $filename); do
21         node_boot "$hostname" "$key" "$@"
22     done
23 }
24
25 function node_dbg () {
26     [[ -z "$@" ]] && { echo "Usage: $0 hostname [command]" ; return 1; }
27     node_key /etc/planetlab/debug_ssh_key.rsa "$@"
28 }
29 function nodes_dbg () {
30     [[ -z "$@" ]] && { echo "Usage: $0 hosts_file [command]" ; return 1; }
31     node_keys /etc/planetlab/debug_ssh_key.rsa "$@"
32 }
33 function clear_known_hosts () {
34     for hostname in "$@"; do    
35         sed -i "/$hostname/d" ~/.ssh/known_hosts
36     done
37 }       
38
39 # convenience 
40 alias mtail=mtail.py
41
42 # navigators - alphabetical
43 alias gobmsource="cd /usr/share/bootmanager"
44 alias goboot="cd /var/www/html/boot"
45 alias godrupal="cd /var/www/html/planetlab"
46 alias gohttplog="cd /var/log/httpd"
47 alias goinit="cd /etc/plc.d"
48 alias golog="cd /var/log/"
49 alias goplcapi="cd /usr/share/plc_api"
50 alias gosqllog="cd /var/lib/pgsql/data/pg_log"
51 alias goyum="cd /var/www/html/install-rpms"
52