Project

General

Profile

1
#!/bin/bash
2
# Runs map with BIEN defaults
3

    
4
selfDir="$(dirname -- "$0")"
5
bin="$selfDir/bin"
6

    
7
shopt -s nullglob
8

    
9
bien_password="$(cat "$selfDir/config/bien_password")"
10

    
11
# VegBIEN DB defaults
12
prefix=in_
13
test "$in_database" = vegbien && . "$bin/vegbien_dest"
14
prefix=out_
15
test "$out_database" = vegbien && . "$bin/vegbien_dest"
16
unset prefix
17

    
18
# Other defaults
19
if test -n "$in_engine"; then
20
    test -n "$in_host" || export in_host=localhost
21
    if test -z "$in_user"; then
22
        if test _"$(hostname)" = _nimoy -a _"$in_engine" = _MySQL; then
23
            . "$bin/env_password" mysql_password "your MySQL password" || exit
24
                # exit this script if password not set
25
            export in_user="$USER" in_password="$mysql_password"
26
            if test "$in_database" = SALVIAS; then in_database=salvias_plots
27
            else in_database=bien2_staging
28
            fi
29
        else
30
            export in_user=bien in_password="$bien_password"
31
        fi
32
    fi
33
fi
34

    
35
exec nice -n +5 "$bin/map" "$@"
(5-5/7)