make a command prompt with your own commands html
#kill-server
#!/bin/bash
RED='\e[31m'
NOCOLOR='\033[0m'
GREEN='\e[92m'
echo -e "Getting PID's from port :$1..."
PIDINFO=`netstat -ano | findstr :$1`
if [ $# -eq 0 ]
then
echo -e "${RED}No port number specified"
echo -e "${NOCOLOR}Usage: kill-server [port-number]"
exit 1
fi
# Convert to array
PIDINFOARR=($PIDINFO)
# Get the PID
PID=$(echo "${PIDINFOARR[4]}" | sed '')
# Kill the server
echo -e "Kill server :$1..."
if tskill "${PID}"; then
echo -e "${GREEN}Server port /:$1 with PID: ${PID} succesfully terminated."
else
echo -e "${RED}Server port /:$1 not succesfully terminated. It might be because server is not running."
exit 1
fi
Are there any code examples left?
New code examples in category Html
-
Html 2022-03-27 21:55:05 how to kill html
-
Html 2022-03-27 21:55:02 How to create web urls without extensions
-
Html 2022-03-27 21:45:11 space between 2 h tags without break
-
Html 2022-03-27 21:40:13 how to resize submit button in html
-
Html 2022-03-27 20:40:18 https://www.codegrepper.com
-
Html 2022-03-27 19:55:09 show image inside table with innerhtml
-
Html 2022-03-27 19:30:47 html email input
-
Html 2022-03-27 18:45:01 how to add favicon in html
-
Html 2022-03-27 18:15:21 picture html
-
Html 2022-03-27 18:15:11 ex: javaasdasdasdasd