Bläddra i källkod

installing pm2

Gamaliel Espinoza 7 år sedan
förälder
incheckning
9a4c06d813
2 ändrade filer med 20 tillägg och 14 borttagningar
  1. 5 2
      configure.py
  2. 15 12
      fourier_install.sh

+ 5 - 2
configure.py

@@ -50,6 +50,10 @@ if ret == 1:
                'ext4 defaults,auto,nofail 0 2" '
                '>> /etc/fstab'
                ))
+
+    if not os.path.isdir('/media/datadrive'):
+        os.mkdir('/media/datadrive')
+
     sp.call(['mount', '-a'])
 
 if not os.path.isdir(src_fourier_path):
@@ -70,5 +74,4 @@ if not os.path.isfile(db_path):
     print('** Applying migrations')
     sp.call(['fourier', 'db', 'migrate'])
     print('** Creating database')
-
-    
+    os.chown(db_path, user.pw_uid, user.pw_gid)

+ 15 - 12
fourier_install.sh

@@ -57,9 +57,9 @@ curl -X POST -F "key=$keycontent" \
 	 -H "Authorization: $BOX_ID $API_SECRET" \
 	 https://api.audiovalid.com/public-key
 
-echo -e "\e[33mPlease add the following public key to server's authorized keys:\e[0m"
-cat $keyfile.pub
-read -p "Press enter to continue"
+# echo -e "\e[33mPlease add the following public key to server's authorized keys:\e[0m"
+# cat $keyfile.pub
+# read -p "Press enter to continue"
 
 if [[ "$OSTYPE" != darwin* ]]; then
 	echo "/usr/bin/autossh -N -f -M 7$PORT -oPubkeyAuthentication=yes -oPasswordAuthentication=no -oLogLevel=error  -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -i $keyfile -R 6$PORT:localhost:22 $tunnel_user@$serverhost -p 22" > $tunnelfile
@@ -152,15 +152,6 @@ if [[ "$OSTYPE" != darwin* ]]; then
 	echo "SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"" | sudo tee -a /etc/udev/rules.d/rtl-sdr.rules
 fi
 
-# --------------------------------- #
-# Generación de los scripts con pm2 #
-# --------------------------------- #
-# cd $programspath
-# pm2 start fourier-ondemand --interpreter python --name ondemand
-# pm2 start server
-# pm2 start monitor
-# pm2 start uploader
-
 [ ! -f "$configfile" ] && \
 	sudo python $installerpath/configure.py \
 		   		$installerpath/fourier-config.json \
@@ -169,6 +160,18 @@ fi
 		   		-receivers $RECEIVERS_COUNT \
 		   		-api-secret $API_SECRET \
 		   		-box-id "$BOX_ID"
+	if [ "$?" -eq 0 ]; then
+		cd "$programspath"
+		pm2 start server
+		pm2 start monitor
+		pm2 start uploader
+		pm2 start ondemand/ondemand/service.py \
+				  --interpreter=python \
+				  --name=ondemand
+		pm2 start http-server
+		pm2 save
+		pm2 startup
+	fi
 	
 if [[ "$OSTYPE" != darwin* ]]; then
 	sudo mysql -u root -e "create database $mysql_db;"