diff --git a/Makefile b/Makefile index 5faff24..68122b1 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,7 @@ release_deb: release_src doc cp contrib/scriptform.init.d_debian rel_deb/usr/share/doc/$(PROG) cp contrib/scriptform.init.d_redhat rel_deb/usr/share/doc/$(PROG) + cp contrib/scriptform.service rel_deb/usr/share/doc/$(PROG) cp -ar contrib/debian/DEBIAN rel_deb/ # Bump version numbers diff --git a/README.md b/README.md index 4587670..af59d78 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,18 @@ For **RedHat / Centos** systems: Then edit `/etc/init.d/scriptform` and change the `FORM_CONFIG` setting to point at the form configuration JSON file you'd like to use. +There's also a **Systemd** unit file, which should work on most systems that +run on systemd: + + sudo cp /usr/share/doc/scriptform/scriptform.service /etc/systemd/system/ + +Then edit `/etc/systemd/system/scriptform.service` and make change the +`FORM_CONFIG` environment variable to point at the form configuration JSON +file you'd like to use. + + + + ## Usage Usage: diff --git a/contrib/scriptform.service b/contrib/scriptform.service new file mode 100644 index 0000000..6fd57f6 --- /dev/null +++ b/contrib/scriptform.service @@ -0,0 +1,14 @@ +[Unit] +Description=Scriptform +After=network.target + +[Service] +Environment=FORM_CONFIG=/home/fboender/Projects/fboender/scriptform/examples/megacorp_acc/megacorp_acc.json +Environment=LOG_FILE=/var/log/scriptform.log +Environment=PORT=8081 +ExecStart=/usr/bin/scriptform --pid-file=/var/run/scriptform.pid --port=${PORT} --log-file=${LOG_FILE} ${FORM_CONFIG} +Type=forking +PIDFile=/var/run/scriptform.pid + +[Install] +WantedBy=default.target