~zinigor/cardano-node/trunk

« back to all changes in this revision

Viewing changes to nix/workbench/run.sh

  • Committer: Igor Zinovyev
  • Date: 2021-08-13 19:12:27 UTC
  • Revision ID: zinigor@gmail.com-20210813191227-stlnsj3mc5ypwn0c
Tags: upstream-1.27.0
ImportĀ upstreamĀ versionĀ 1.27.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
usage_run() {
 
2
     usage "run" "Managing cluster runs" <<EOF
 
3
    list                  List cluster runs
 
4
    mkname                Allocate a cluster run name/id/tag
 
5
    create                Create a cluster run directory
 
6
EOF
 
7
}
 
8
 
 
9
run() {
 
10
local op=${1:-list}; test $# -gt 0 && shift
 
11
 
 
12
case "${op}" in
 
13
    list )
 
14
        (test -d "$global_runsdir" && cd "$global_runsdir" && find . -type d)
 
15
        ;;
 
16
 
 
17
    mkname )
 
18
        local usage="USAGE: wb run mkname BATCH-NAME PROFILE-NAME"
 
19
        local batch=${1:?$usage}
 
20
        local prof=${2:?$usage}
 
21
        echo -n "$(date +'%Y'-'%m'-'%d'-'%H.%M').$batch.$prof"
 
22
        ;;
 
23
 
 
24
    create )
 
25
        local usage="USAGE: wb run create ??? BATCH-NAME PROFILE-NAME"
 
26
        ## Assumptions:
 
27
        ##   - genesis has been created
 
28
        ##   - the cluster is operating
 
29
        local name=${1:?$usage}
 
30
        local batch=${2:?$usage}
 
31
        local prof=${3:?$usage}
 
32
 
 
33
        local dir=$runsdir/$name
 
34
        if test "$(realpath "$dir")" = test "$(realpath "$global_runsdir")" -o "$name" = '.'
 
35
        then fatal "bad, bad tag '$name'"; fi
 
36
        ;;
 
37
 
 
38
    ### Undocumented
 
39
    describe | d )
 
40
        cat <<EOF
 
41
global_runsdir=$global_runsdir
 
42
EOF
 
43
        ;;
 
44
 
 
45
    * ) usage_run;; esac
 
46
}