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