-
Notifications
You must be signed in to change notification settings - Fork 10
/
portable_adsorber.sh
executable file
·37 lines (30 loc) · 1019 Bytes
/
portable_adsorber.sh
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
#!/bin/sh
parameters="${*}"
printf "Running Adsorber in portable-mode"
if [ -n "${parameters}" ]; then
printf " with %s parameter(s): '%s'" "${#}" "${parameters}"
fi
printf " ...\\n"
# Get the path of scripts root directory
readonly source_dir_path="$(cd "$(dirname "${0}")" && pwd)"
# Call adsorber from the src/bin/ directory
runAdsorber()
{
echo ""
# shellcheck disable=SC2086
( "${source_dir_path}/src/bin/adsorber" "${parameters}" "--no-scheduler" )
exit_code="${?}"
echo ""
return "${exit_code}"
}
if runAdsorber; then
echo "Adsorber in portable-mode exited with code ${exit_code}."
else
# I defined exit code 80 as an error code in the adsorber main executable
# if wrong or no input has been made
if [ "${exit_code}" -eq 80 ]; then
echo "You've supplied no or wrong parameters."
fi
echo "Adsorber in portable-mode exited with code ${exit_code}. Thats an error."
exit ${exit_code}
fi