Skip to content

Commit 4128351

Browse files
authored
Merge pull request #2 from chapeupreto/add_better_status_message
Add better status message
2 parents ed39c5c + 8dee603 commit 4128351

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.log
2+
*.pid

server

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ usage () {
1616
usage: ./$NAME <command> [<hostname>:<port>]
1717
1818
Available commands:
19+
1920
start Starts PHP built-in web server server on specified hostname:port, default is localhost:$PORT
2021
stop Stops the PHP built-in web server
2122
restart Stops and Starts on previously specified hostname:port
@@ -113,12 +114,12 @@ start_server () {
113114
read_pidfile() {
114115
if [[ -e "$PIDFILE" ]]; then
115116
PIDFILECONTENT=`cat "$PIDFILE"`
116-
IFS=: read HOST PORT PID <<< "$PIDFILECONTENT:"
117+
IFS=: read HOST PORT PID <<< "$PIDFILECONTENT:"
117118
return 0
118119
else
119120
return 1
120121
fi
121-
122+
122123
}
123124
stop_server () {
124125
if read_pidfile; then
@@ -134,7 +135,7 @@ stop_server () {
134135

135136
status_server() {
136137
if read_pidfile && kill -0 "$PID" ; then
137-
printf "${BLUE}"$NAME" is running...${NORMAL}\n"
138+
printf "${BLUE}"$NAME" is running on ${HOST}:${PORT}${NORMAL}\n"
138139
else
139140
printf "${YELLOW}"$NAME" is not running!${NORMAL}\n"
140141
fi

0 commit comments

Comments
 (0)