File: deploy.sh

package info (click to toggle)
dotlrn 2.5.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 108,252 kB
  • ctags: 19,369
  • sloc: tcl: 219,601; sql: 202,152; xml: 127,658; java: 7,268; php: 4,780; sh: 2,428; perl: 1,207; makefile: 134
file content (56 lines) | stat: -rwxr-xr-x 1,221 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bin/tclsh
# process command line arguments
foreach arg $argv {
    switch -glob -- $arg {
	--status  {set status_p true}
	--help*   {set help_p true}
	--switch* {set switch_p true}
    }
}

if { [llength $argv] = 0 } {
    set help_p true
}

if { $help_p } {
    puts stdout {Usage: deploy [--switch | --status | --help]}
    exit
}

if { $status_p } {
    set balance_txt [exec /usr/sbin/balance -c show 80]
    puts stdout $balance_txt
    exit
}

# the old bash script:
# PROD=primary
# ALT=alternate
# BASE_DIR=/var/lib/aolserver
# SVC_DIR=/var/lib/svscan
# OLD=$1
# NEW=$2

# # basic premise: a server named foo is controlled by daemontools as $SVC_DIR/foo,
# # and is actually rooted at BASE_DIR/foo
# # when it is moved to production, its config.tcl is updated 
# # and the BASE_DIR/PROD link is changed to point to it
# # and BASE_DIR/ALT is changed to point to whatever it replaced

# svc -d $SVC_DIR/$OLD
# svc -d $SVC_DIR/$NEW
# cd $BASE_DIR
# rm $PROD
# rm $ALT
# cd $BASE_DIR/$NEW/etc
# cvs up -r $PROD config.tcl
# cd $BASE_DIR/$OLD/etc
# cvs up -r $ALT config.tcl
# cd $BASE_DIR
# ln -s $NEW $PROD
# ln -s $OLD $ALT
# svc -u $SVC_DIR/$NEW
# svc -u $SVC_DIR/$OLD

# # show status
# svstat $SVC_DIR/*