|
@@ -11,11 +11,15 @@ fi
|
|
|
dirpath=$(dirname "$filename")
|
|
dirpath=$(dirname "$filename")
|
|
|
echo $type $filename $dirpath
|
|
echo $type $filename $dirpath
|
|
|
|
|
|
|
|
-network_dest_dir="/home/forlinx/Desktop/workspace/TPMFM-A"
|
|
|
|
|
-monitor_dest_dir="/home/forlinx/monitor"
|
|
|
|
|
-compute_dest_dir="/home/forlinx/Desktop/workspace/dataParsing"
|
|
|
|
|
|
|
+src_workspace="/userdata/workspace"
|
|
|
|
|
+dst_workspace="/home/forlinx/Desktop/workspace"
|
|
|
|
|
|
|
|
-mkdir -p "$network_dest_dir" "$monitor_dest_dir" "$compute_dest_dir"
|
|
|
|
|
|
|
+network_dir="$src_workspace/TPMFM-A"
|
|
|
|
|
+monitor_dir="$src_workspace/monitor"
|
|
|
|
|
+compute_dir="$src_workspace/dataParsing"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+mkdir -p "$network_dir" "$monitor_dir" "$compute_dir"
|
|
|
|
|
|
|
|
echo "stopping app..."
|
|
echo "stopping app..."
|
|
|
systemctl stop monitor
|
|
systemctl stop monitor
|
|
@@ -31,21 +35,21 @@ echo "monitor stopped."
|
|
|
case "$type" in
|
|
case "$type" in
|
|
|
network)
|
|
network)
|
|
|
echo "Extracting network package..."
|
|
echo "Extracting network package..."
|
|
|
- tar --overwrite -zxvf "$filename" -C "$network_dest_dir"
|
|
|
|
|
|
|
+ tar --overwrite -zxvf "$filename" -C "$network_dir"
|
|
|
;;
|
|
;;
|
|
|
monitor)
|
|
monitor)
|
|
|
echo "Extracting monitor package..."
|
|
echo "Extracting monitor package..."
|
|
|
- tar --overwrite -zxvf "$filename" -C "$monitor_dest_dir"
|
|
|
|
|
- if [ -f $monitor_dest_dir/monitor.service ]; then
|
|
|
|
|
- cp "$monitor_dest_dir/monitor.service" /etc/systemd/system/
|
|
|
|
|
|
|
+ tar --overwrite -zxvf "$filename" -C "$monitor_dir"
|
|
|
|
|
+ if [ -f $monitor_dir/monitor.service ]; then
|
|
|
|
|
+ cp "$monitor_dir/monitor.service" /etc/systemd/system/
|
|
|
systemctl daemon-reload
|
|
systemctl daemon-reload
|
|
|
else
|
|
else
|
|
|
- echo "monitor.service not found in $monitor_dest_dir"
|
|
|
|
|
|
|
+ echo "monitor.service not found in $monitor_dir"
|
|
|
fi
|
|
fi
|
|
|
;;
|
|
;;
|
|
|
compute)
|
|
compute)
|
|
|
echo "Extracting compute package..."
|
|
echo "Extracting compute package..."
|
|
|
- tar --overwrite -zxvf "$filename" -C "$compute_dest_dir"
|
|
|
|
|
|
|
+ tar --overwrite -zxvf "$filename" -C "$compute_dir"
|
|
|
;;
|
|
;;
|
|
|
*)
|
|
*)
|
|
|
echo "Unsupported file type: $type"
|
|
echo "Unsupported file type: $type"
|
|
@@ -53,6 +57,11 @@ case "$type" in
|
|
|
;;
|
|
;;
|
|
|
esac
|
|
esac
|
|
|
|
|
|
|
|
|
|
+echo "create a symbolic link..."
|
|
|
|
|
+rm -rf $dst_workspace
|
|
|
|
|
+ln -sf /userdata/workspace $dst_workspace
|
|
|
|
|
+chown -h forlinx:forlinx $dst_workspace
|
|
|
|
|
+
|
|
|
echo "restarting app..."
|
|
echo "restarting app..."
|
|
|
systemctl enable --now monitor
|
|
systemctl enable --now monitor
|
|
|
|
|
|