-
Notifications
You must be signed in to change notification settings - Fork 2
/
smartcoin_backend.sh
61 lines (51 loc) · 1.47 KB
/
smartcoin_backend.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
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
# NOT USED
# This is reserverd for future use.
# There are some things that may need to be done from outside of the current shell
# This script is for those occations.
# Most of the programming here was for testing purposes...
if [[ $( dirname "$0" ) == "/usr/bin" ]]; then
CUR_LOCATION=$(dirname $(readlink -f $( dirname "$0" )/smartcoin))
else
CUR_LOCATION="$( cd "$( dirname "$0" )" && pwd )"
fi
. $CUR_LOCATION/smartcoin_ops.sh
# Create the command pipe to the backend...
trap "rm -f $commPipe" EXIT
if [[ ! -p $commPipe ]]; then
mkfifo $commPipe
fi
while read cmd <$commPipe; do
case "$cmd" in
attach)
# Attach to screen session
read session <$commPipe
screen -d -r $session
;;
detach)
# Detach from screen
screen -d $sessionName
screen -d $minerSession
;;
goto_window)
read session <$commPipe
read window <$commPipe
screen -d -r $session -p $window
;;
exit)
screen -d -r $sessionName -X quit
screen -d -r $minerSession -X quit
exit
;;
restart)
# Restart smartcoin
screen -d -r $sessionName -X quit
screen -d -r $minerSession -X quit
smartcoin
exit
;;
test)
echo "Test Successful!"
esac
done
echo "Exiting!"