ansitest/simplewebserver.sh

19 lines
604 B
Bash
Raw Normal View History

2021-04-09 15:14:49 -05:00
#!/bin/sh
2021-04-09 15:18:29 -05:00
# Basically serve current dir as browseable over a given port; cd and run
# - needs to run as root in FG (for ports under 1025) and can run unprivileged on e.g. port 8000 if firewall allows
# - need to ^C to kill this
2021-04-09 15:14:49 -05:00
# REF: https://www.perlmonks.org/?node_id=865148
2021-04-09 15:18:29 -05:00
# REF: https://www.w3.org/Daemon/User/Installation/PrivilegedPorts.html#:~:text=Priviliged%20ports,has%20put%20up%20for%20you.
2021-04-13 12:12:10 -05:00
runport=8080
##Check for root priviliges
if [ "$(id -u)" -ne 0 ]; then
runport=80
fi
echo "$0 running on port $runport"
python -m SimpleHTTPServer $runport > ~/simple-web-server.log 2>&1
2021-04-09 15:14:49 -05:00
date