Create systemd file
$ cat /etc/systemd/system/jekyll.service
# Description: to make `jekyll serve` a system service and start on boot
#
# Usage: place this file at `/etc/systemd/system/jekyll.service`
# then run
# sudo systemctl start jekyll.service
# sudo systemctl enable jekyll.service
[Unit]
Description=Jekyll service
After=syslog.target network.target
[Service]
User=username
Type=simple
WorkingDirectory=/home/username/www
ExecStart=/home/username/gems/bin/bundle exec jekyll serve --host 192.168.0.16
ExecStop=/usr/bin/pkill -f jekyll
Restart=always
TimeoutStartSec=60
RestartSec=60
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=jekyll
[Install]
WantedBy=multi-user.target network-online.target
Start jekyll service
$ sudo systemctl daemon-reload
$ sudo systemctl start jekyll
$ sudo systemctl enable jekyll
$ sudo systemctl status jekyll
● jekyll.service - Jekyll service
Loaded: loaded (/etc/systemd/system/jekyll.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2020-08-19 21:14:18 PDT; 7s ago
Main PID: 35228 (ruby2.7)
Tasks: 4 (limit: 13599)
Memory: 83.8M
CGroup: /system.slice/jekyll.service
└─35228 ruby2.7 /home/[username]/www/vendor/bundle/ruby/2.7.0/bin/jekyll serve --host 192.168.0.16
Aug 19 21:14:19 skyhawk-01 jekyll[35228]: Configuration file: /home/username/www/_config.yml
Aug 19 21:14:19 skyhawk-01 jekyll[35228]: Source: /home/username/www
Aug 19 21:14:19 skyhawk-01 jekyll[35228]: Destination: /home/username/www/_site
Aug 19 21:14:19 skyhawk-01 jekyll[35228]: Incremental build: disabled. Enable with --incremental
Aug 19 21:14:19 skyhawk-01 jekyll[35228]: Generating...
Aug 19 21:14:19 skyhawk-01 jekyll[35228]: Jekyll Feed: Generating feed for posts
Aug 19 21:14:21 skyhawk-01 jekyll[35228]: done in 2.455 seconds.
Aug 19 21:14:21 skyhawk-01 jekyll[35228]: Auto-regeneration: enabled for '/home/username/www'
Aug 19 21:14:21 skyhawk-01 jekyll[35228]: Server address: http://192.168.0.16:4000
Aug 19 21:14:21 skyhawk-01 jekyll[35228]: Server running... press ctrl-c to stop.