Bladeren bron

Update to 0.4

Maniack Crudelis 8 jaren geleden
bovenliggende
commit
4156dab51d
5 gewijzigde bestanden met toevoegingen van 48 en 5 verwijderingen
  1. 1 1
      README.md
  2. 1 1
      README_fr.md
  3. 2 2
      conf/app.src
  4. 1 1
      manifest.json
  5. 43 0
      scripts/_common.sh

+ 1 - 1
README.md

@@ -15,7 +15,7 @@ It can also makes backups of specified directories.
 Your backups can be send to many other places, local or distant.  
 Archivist is automatically launched periodicaly to update your backups and send the modifications to the other places.
 
-**Shipped version:** 0.3
+**Shipped version:** 0.4
 
 ## Screenshots
 

+ 1 - 1
README_fr.md

@@ -15,7 +15,7 @@ Il peut également faire des sauvegardes de répertoires spécifiques.
 Vos sauvegardes peuvent être envoyées à de nombreux autres endroits, locaux ou distants.  
 Archivist est automatiquement lancé périodiquement pour mettre à jour vos sauvegardes et envoyer les modifications aux autres emplacements.
 
-**Version embarquée:** 0.3
+**Version embarquée:** 0.4
 
 ## Captures d'écran
 

+ 2 - 2
conf/app.src

@@ -1,5 +1,5 @@
-SOURCE_URL=https://github.com/maniackcrudelis/archivist/archive/v0.3.tar.gz
-SOURCE_SUM=dedc9e77677b8a65553873e91eeeaeae
+SOURCE_URL=https://github.com/maniackcrudelis/archivist/archive/v0.4.tar.gz
+SOURCE_SUM=1c6e3a62973f22662b95eb0bf4985daf
 SOURCE_SUM_PRG=md5sum
 SOURCE_FORMAT=tar.gz
 SOURCE_IN_SUBDIR=true

+ 1 - 1
manifest.json

@@ -6,7 +6,7 @@
 		"en": "Automatic backups.",
 		"fr": "Sauvegardes automatiques."
 	},
-	"version": "0.3",
+	"version": "0.4",
 	"url": "https://github.com/maniackcrudelis/archivist",
 	"license": "GPL-3.0",
 	"maintainer": {

+ 43 - 0
scripts/_common.sh

@@ -234,6 +234,49 @@ EOF
 	chmod +x "/etc/cron.daily/node_update"
 }
 
+#=================================================
+# EXPERIMENTAL HELPERS
+#=================================================
+
+ynh_check_starting () {
+	local line_to_match="$1"
+	local app_log="${2:-/var/log/$app/$app.log}"
+	local timeout=${3:-300}
+
+	ynh_clean_check_starting () {
+		# Stop the execution of tail.
+		kill -s 15 $pid_tail 2>&1
+		ynh_secure_remove "$templog" 2>&1
+	}
+
+	echo "Starting of $app" >&2
+	systemctl restart $app
+	local templog="$(mktemp)"
+	# Following the starting of the app in its log
+	tail -f -n1 "$app_log" > "$templog" &
+	# Get the PID of the tail command
+	local pid_tail=$!
+
+	local i=0
+	for i in `seq 1 $timeout`
+	do
+		# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
+		if grep --quiet "$line_to_match" "$templog"
+		then
+			echo "The service $app has correctly started." >&2
+			break
+		fi
+		echo -n "." >&2
+		sleep 1
+	done
+	if [ $i -eq $timeout ]
+	then
+		echo "The service $app didn't fully started before the timeout." >&2
+	fi
+
+	echo ""
+	ynh_clean_check_starting
+}
 
 #=================================================
 #============= FUTURE YUNOHOST HELPER ============