//start supervisord
sudo su
cd /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver
supervisord -c supervisord.conf
//stop supervisord
// first switch to root user
sudo su
cd /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver
https://stackoverflow.com/questions/14479894/stopping-supervisord-shut-down
ps -ef | grep supervisord
kill -s SIGTERM 15923( only one number a line , line with 2 number are NOT right)
http://supervisord.org/running.html#signals
$$$$$$$$ end $$$$$$$$$$$$$$$ quick restart gohttpserver $$$$$$$$$$$$$$$$$$$$$
****************************************************************
https://github.com/indexzero/http-server
linux
putty:
// first switch to root user
sudo su
// install
npm install http-server -g
// run
http-server ./fileRestAPI
**********************************************
go http server
C:\Users\engcid299\go\src\github.com\codeskyblue\gohttpserver>gohttpserver -r ./testdata --port 8000 --upload --delete --cors
//install go linux
https://tecadmin.net/install-go-on-centos/
wget https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz
tar -xvf go1.10.1.linux-amd64.tar.gz
//Setup Go Environment
// first switch to root user
sudo su
export GOROOT=/home/hoogw/go
export GOPATH=/home/hoogw/gowork
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
--------------------------------------------------
install gohttpserver
mkdir gowork
cd gowork
// this will create bin, src folder
go get -v github.com/codeskyblue/gohttpserver
cd src/github.com/codeskyblue/gohttpserver
go build
------------------
// copy pdf file to gowork
// DO not use commmend below, instead use WinSCP (download and install, no admin privilage needed)
//cp -r /home/hoogw/fileRestAPI /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver
//cp -r /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver/testdata/config.yml /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver/fileRestAPI
when start WinSCP, must login as root user, by
https://stackoverflow.com/questions/34798936/how-to-run-sudo-command-in-winscp-to-transfer-files-from-windows-to-linux/53787591#53787591
login screen, left panel, choose new site, right panel, file protocol: choose SCP, click advanced
left panel, choose SCP/shell, right panel, Shell: type 'sudo su -'
There is an option in WinSCP that does exactly what you are looking for:
------------------------
Delete build.sh file, no need.
Modify main.go
// run it, Must use ./, to use new developing version. otherwise, it will use old installed version
// always is 8000 for https, no http
./gohttpserver -r ./fileRestAPI --cors
./gohttpserver -r ./fileRestAPI --port 8000 --upload --delete --cors
// run it as background
// create file, save to where you call gohttpserver folder.
// create config file
// use nano to edit, or you can create it at windows, use winSCP to copy over
nano supervisord.conf
// type content
[program:supervisord]
command=./gohttpserver -r ./fileRestAPI --cors
If you want to save the changes you've made, press Ctrl + O.
To exit nano, type Ctrl + X. If you ask nano to exit from a modified file, it will ask you if you want to save it.
Just press N in case you don't, or Y in case you do. It will then ask you for a filename.
Just type it in and press Enter.
//start supervisord
sudo su
cd /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver
supervisord -c supervisord.conf
//stop supervisord
// first switch to root user
sudo su
cd /home/hoogw/gowork/src/github.com/codeskyblue/gohttpserver
https://stackoverflow.com/questions/14479894/stopping-supervisord-shut-down
ps -ef | grep supervisord
kill -s SIGTERM 15923( only one number a line , line with 2 number are NOT right)
http://supervisord.org/running.html#signals
ps -ef | grep supervisord
You will get some pid of supervisord just like these
root 2641 12938 0 04:52 pts/1 00:00:00 grep --color=auto supervisord
root 29646 1 0 04:45 ? 00:00:00 /usr/bin/python /usr/local/bin/supervisord
if you get output like that, your pid is the second one ( with only one number, it will not change if you run again again, but other number are changing. then if you want to shut down your supervisord you can do this
kill -s SIGTERM 29646
===================================
localhost run gohttpserver
./gohttpserver -r ./fileRestAPI --port 8000 --cors
go build
=========================================
supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
;logfile=/var/log/supervisord/supervisord.log ; supervisord log file
;logfile_maxbytes=50MB ; maximum size of logfile before rotation
;logfile_backups=10 ; number of backed up logfiles
;loglevel=error ; info, debug, warn, trace
;pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
minfds=1024 ; number of startup file descriptors
minprocs=200 ; number of process descriptors
user=root ; default user
;childlogdir=/var/log/supervisord/ ; where child log files will
[program:fileRestAPI]
command=./gohttpserver -r ./fileRestAPI --cors
;command=gohttpserver -r ./fileRestAPI --port 8000 --upload --delete --cors
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket