Commits

Juan Fuentes committed d6e7153

simplified the code, added code to insure the creation of .pid file

Comments (0)

Files changed (1)

 isup()
 {
 	if [ -f $HOME/.p9p/.pid ]; then
-		p9pid=$(cat $HOME/.p9p/.pid)
-		pid=$(process_exists)
-		if [[ $p9pid == $pid ]]; then
-			[ -n $p9pid ] && echo $p9pid && return 0
-		else
-			[ -n $pid ] && echo $pid && return 0
-		fi
+		echo $(cat $HOME/.p9p/.pid)
+		return 0
 	else
-		if [ ! -z $(process_exists) ]; then
-			echo $(process_exists)
-		fi
+		# create $HOME/.p9p/.pid if doesn't exist.
+		echo $(process_exists)
+		echo $(process_exists) > $HOME/.p9p/.pid
+		return 0
 	fi
 	return 1
 }
 {	
 	if [ -z $(isup) ]; then
 		$PLAN9/bin/9 plumber
-		p9pid=$(pidof plumber)
-		echo $p9pid > $HOME/.p9p/.pid
-	elif [ ! -f $HOME/.p9p/.pid ]; then
-		echo $(isup) > $HOME/.p9p/.pid
+		echo $(process_exists) > $HOME/.p9p/.pid
 	fi
-	unset p9pid
+	return 0
 }
 
 stop()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.