forked from hummingbot/hummingbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start
executable file
·60 lines (52 loc) · 1.37 KB
/
start
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
57
58
59
60
#!/bin/bash
PASSWORD=""
FILENAME=""
# Argument parsing
while getopts ":p:f:" opt; do
case $opt in
p)
PASSWORD="$OPTARG"
;;
f)
FILENAME="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# Check if bin/hummingbot_quickstart.py exists
if [[ ! -f bin/hummingbot_quickstart.py ]]; then
echo "Error: bin/hummingbot_quickstart.py command not found. Make sure you are in the Hummingbot root directory"
exit 1
fi
# Check if the hummingbot conda environment is activated
if [[ $CONDA_DEFAULT_ENV != "hummingbot" ]]; then
echo "Error: 'hummingbot' conda environment is not activated. Please activate it and try again."
exit 1
fi
# Build the command to run
CMD="./bin/hummingbot_quickstart.py"
if [[ ! -z "$PASSWORD" ]]; then
CMD="$CMD -p \"$PASSWORD\""
fi
if [[ ! -z "$FILENAME" ]]; then
CMD="$CMD -f \"$FILENAME\""
fi
# Clear the errors.log file first before executing
> ./logs/errors.log
# Execute the command
eval $CMD 2>> ./logs/errors.log
# Check errors.log for specific errors
if grep -q "Invalid password" ./logs/errors.log; then
echo "Error: Incorrect password provided."
exit 1
elif grep -q "FileNotFoundError" ./logs/errors.log; then
echo "Error: Invalid file or filename provided."
exit 2
fi