Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hugo server should abort if user specified a port and it is taken #1901

Closed
zaichang opened this issue Feb 27, 2016 · 2 comments
Closed

hugo server should abort if user specified a port and it is taken #1901

zaichang opened this issue Feb 27, 2016 · 2 comments

Comments

@zaichang
Copy link

If a user runs hugo server and specifies a port, e.g. hugo server --port=55555 currently what it does is assign new port:

ERROR: 2016/02/25 port 55555 already in use, attempting to use an available port

I would argue that if the port is currently in use, hugo should abort instead of assigning a new port, because the user specified the port for a reason. For example it is the port that's exposed in a container or in a shared hosting environment.

In production it is also useful to start a server periodically via crontab in order to automatically restart a server in case of it crashing, and the current behaviour of hugo server results in processes being spawned with every call. It would be nicer if hugo aborts thus allowing the cronjob to restart the server if it dies for any reason.

My current workaround is a script that store a pid file and manages it with start/stop/restart comments as described in this thread.

@bep bep closed this as completed in 9349a88 Feb 27, 2016
@zaichang
Copy link
Author

Thanks for the quick patch!

tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
@github-actions
Copy link

github-actions bot commented Apr 9, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants