fix: run moves to file directory before executing hugo so git safe errors are not thrown

fix: created an .example systemd service.  for instance create a copy and modify for that machine, thus removed hugo@.service from repo
master
Kebler Network System Administrator 2022-04-30 12:51:56 -07:00
parent 1776174545
commit 42dedabba9
4 changed files with 25 additions and 19 deletions

2
run
View File

@ -20,6 +20,8 @@ HUGO=${HUGO:-$(command -v hugo)}
PORT=${PORT:-8096} PORT=${PORT:-8096}
echo site files in $DATA_DIR listening on port $PORT echo site files in $DATA_DIR listening on port $PORT
# [[ $(netstat -tulpn | grep LISTEN | grep 0.0.0.0:$PORT) ]] && echo tcp port $PORT is busy can not start hugo server && exit # [[ $(netstat -tulpn | grep LISTEN | grep 0.0.0.0:$PORT) ]] && echo tcp port $PORT is busy can not start hugo server && exit
cd $DATA_DIR
ls -la
CMD="$HUGO server CMD="$HUGO server
$([[ $BASE_URL = "https://"* ]] && echo " --liveReloadPort 443") $([[ $BASE_URL = "https://"* ]] && echo " --liveReloadPort 443")
--bind 0.0.0.0 --bind 0.0.0.0

View File

@ -1,18 +0,0 @@
[Unit]
Description=Live Hugo Server for a Site
After=network-online.target
Requires=opt.mount
After=opt.mount
Requires=mnt-data.mount
After=mnt-data.mount
[Service]
# User=sysadmin
Group=sysadmin
Type=simple
ExecStart=/bin/bash /opt/hugo/run %i
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target

View File

@ -0,0 +1,22 @@
[Unit]
Description=Live Hugo Server for a Site
After=network-online.target
# if opt is mounted you'll need these
#Requires=opt.mount
# After=opt.mount
# Requires=mnt-data.mount
# After=mnt-data.mount
[Service]
# set the main user for your system
#User=ubuntu
#Group=docker
Type=simple
# run will change into the files directory
# be sure to set the correct absolute directory where run command (hugo repo) is located
ExecStart=/bin/bash /path/to/hugo/repo/run %i
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target

@ -1 +1 @@
Subproject commit 1ad4d928af367cf6695159521383304ee15530e0 Subproject commit 69c9a476a926cae3ddfba8eaad1e66965cfabc13