Add Scripts
This commit is contained in:
parent
08f5fb8020
commit
fcd93b86a5
|
@ -0,0 +1,54 @@
|
|||
#!/bin/sh
|
||||
# dLux Start Manager Shell Script
|
||||
# Copyright CADawg 2021
|
||||
|
||||
DIRX=$(dirname $(readlink -f $0))
|
||||
|
||||
if test -f "$DIRX/install/DONOTDELETE"; then
|
||||
echo "Welcome Back!"
|
||||
else
|
||||
echo "Hello there. Let me get this setup for you!"
|
||||
|
||||
# Crontab setup for restart script
|
||||
crontab -l > mycron
|
||||
echo "0 * * * * $DIRX/instances/restart.sh" >> mycron
|
||||
crontab mycron
|
||||
rm mycron
|
||||
|
||||
touch "$DIRX/install/DONOTDELETE"
|
||||
|
||||
# Install pm2
|
||||
npm i -g pm2
|
||||
fi
|
||||
|
||||
echo "Enter Your DLUX NODE's Hive Username"
|
||||
read username
|
||||
|
||||
echo "Enter The Active Key for the account"
|
||||
read activekey
|
||||
|
||||
echo "Enter The Memo Key for the account"
|
||||
read memokey
|
||||
|
||||
DLUXFOLDER="$DIRX/instances/dlux-$username"
|
||||
|
||||
PORTX=$(cat "$DIRX/install/NEXTPORT")
|
||||
|
||||
echo $(($PORTX + 1)) > "$DIRX/install/NEXTPORT"
|
||||
|
||||
git clone https://github.com/dluxio/dlux_open_token.git $DLUXFOLDER
|
||||
|
||||
cd $DLUXFOLDER
|
||||
|
||||
touch "$DLUXFOLDER/.env"
|
||||
|
||||
echo "account=$username" >> "$DLUXFOLDER/.env"
|
||||
echo "active=$activekey" >> "$DLUXFOLDER/.env"
|
||||
echo "memo=$memokey" >> "$DLUXFOLDER/.env"
|
||||
echo "PORT=$PORTX" >> "$DLUXFOLDER/.env"
|
||||
|
||||
npm i
|
||||
|
||||
pm2 start index.js --name "dlux-$username"
|
||||
|
||||
echo "Done! Your new node is setup and will be automatically updated every hour."
|
|
@ -0,0 +1 @@
|
|||
3000
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
# dLux End Manager Shell Script
|
||||
# CADawg 2021
|
||||
|
||||
DIRX=$(dirname $(readlink -f $0))
|
||||
cd $DIRX
|
||||
|
||||
for d in dlux*/ ; do
|
||||
v=${d%/}
|
||||
echo "Cleaning up ${v}"
|
||||
pm2 delete $v
|
||||
pm2 save
|
||||
done
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
# dLux Restart Manager Shell Script
|
||||
# CADawg 2021
|
||||
|
||||
DIRX=$(dirname $(readlink -f $0))
|
||||
cd $DIRX
|
||||
|
||||
for d in dlux*/ ; do
|
||||
v=${d%/}
|
||||
echo "Updating ${d}"
|
||||
cd $d
|
||||
git pull # update from git
|
||||
npm i # update packages
|
||||
pm2 restart $v # restart node
|
||||
cd ..
|
||||
done
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
# dLux Start Manager Shell Script
|
||||
# CADawg 2021
|
||||
|
||||
DIRX=$(dirname $(readlink -f $0))
|
||||
cd $DIRX
|
||||
|
||||
for d in dlux*/ ; do
|
||||
v=${d%/}
|
||||
echo "Running ${d}"
|
||||
cd $d
|
||||
git pull
|
||||
pm2 start index.js --name $v
|
||||
cd ..
|
||||
pm2 save
|
||||
done
|
Loading…
Reference in New Issue