forked from williambnorton/darp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateSW.bash
More file actions
executable file
·55 lines (46 loc) · 1.41 KB
/
updateSW.bash
File metadata and controls
executable file
·55 lines (46 loc) · 1.41 KB
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
#!/bin/bash
# updateSW.bash
#
if [ $# -ne 0 ]; then
echo `date` Running $0 in DAEMON mode. $#
DAEMON="YES"
fi
POLLFREQ=45
echo `date` updateSW.bash
while :
do
DARPDIR=~/darp
cd $DARPDIR
CURRENT=`ls Build*`
#echo `date` Current SW is `ls Build*`
cd /tmp
rm -rf /tmp/darp
#mv $DARPDIR /tmp/darp
#3echo `date` Cloning new darp code from github
( git clone https://github.com/noia-network/darp.git /tmp/darp 2>&1 ) >/dev/null
cd /tmp/darp
NEW=`ls Build*`
echo UPDATESW.BASH "$CURRENT" "$NEW"
if [ "$CURRENT" == "$NEW" ]; then
#echo `date` No Change DAEMON=$DAEMON
if [ "$DAEMON" != "YES" ]; then
echo "updateSW.bash DONE WITH SINGLE STARTUP RUN....Exitting $0";
exit 0
fi
else
echo `date` Software changed. Was $CURRENT Now is $NEW
cd /tmp/darp
echo 'CLONED INTO /tmp directory. YOU NEED A new Bash shell: cd ~;cd darp;ls'
#echo Killing handlepulse to force reload: `ls $DARPDIR/*.pid`
#killList=`cat $DARPDIR/*.pid`
kill `ps aux|grep "node handlepulse" | grep -v grep | awk '{ print $2}'`
cd /tmp
mv $DARPDIR /tmp/darp.`date +%y%m%d.%H%M`
mv darp $HOME
echo `date` New Code installed:
cd $DARPDIR; ls
exit 1
fi
echo `date` Completed git clone into ~/darp - CURRENT=$CURRENT NEW=$NEW
sleep $POLLFREQ
done