gmgauthier.com/hugo-server

23 lines
621 B
Bash
Executable File

#!/usr/bin/env bash
export LOG=./logs/hugo-server.log
if [ -n "$1" ]; then
if [[ "$1" == "start" ]]; then
hugo server -D --disableFastRender --enableGitInfo -v --debug > $LOG 2>&1 &
echo "Server started on $(pidof hugo)"
elif [[ "$1" == "stop" ]]; then
kill -9 "$(pidof hugo)"
elif [[ "$1" == "status" ]]; then
pid=$(pidof hugo)
if [ -n "$pid" ]; then
echo "Hugo Server Active. PID: ${pid}"
else
echo "Hugo Server Is Inactive."
fi
fi
else
echo "You can 'start' or 'stop' the server, or get the 'status'."
exit 1
fi