Anonymous avatar Anonymous committed 7719804

general cleanup to chat script

Comments (0)

Files changed (1)

 
 PREFIX="$HOME/irc"
 SERVERS="$PREFIX/servers"
+LOG="$PREFIX/log"
+
+[ -f "$LOG" ] && mv "$LOG" "$LOG.old"
+
+
+pgrep -lf pcw >> "$LOG" 2>&1 && echo "WARNING: pcw already running" >> "$LOG"
+pcw "$PREFIX" >> "$LOG" 2>&1 &
 
 while read line; do
 	serv="${line%% *}"
 	# start ii first, so we don't hang trying to write to the fifo
 	while true; do
 		ii -n "$nick" -s "$serv" -i "$PREFIX" 
-		[ $? -eq 2] || break # only restart ii on timeout (not default for ii)
-	done &
+		[ $? -eq 2 ] || break # only restart ii on timeout (not default for ii)
+	done >> "$LOG" 2>&1 &
 
 	while read line; do
 		[ -n "$line" ] || break # stop on empty line
 		cmd="${line#* }"
 		echo "$cmd" > "$PREFIX/$serv/$fifo"
 	done
-done
+done < "$SERVERS" >> "$LOG" 2>&1
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.