Browse Source

Merge pull request #148 from troglodyne/systemd_service_files

Cruise Control for Cool
George S. Baugh 5 years ago
parent
commit
9c8bd4e952
2 changed files with 19 additions and 0 deletions
  1. 10 0
      Makefile
  2. 9 0
      service-files/systemd.unit

+ 10 - 0
Makefile

@@ -5,6 +5,16 @@ install:
 	test -d data/files || mkdir data/files
 	test -d data/files || mkdir data/files
 	rm pod2htmd.tmp; /bin/true
 	rm pod2htmd.tmp; /bin/true
 
 
+.PHONY: install-service
+install-service:
+	mkdir -p ~/.config/systemd/user
+	cp service-files/systemd.unit ~/.config/systemd/user/tCMS.service
+	sed -ie 's#__REPLACEME__#$(shell pwd)#g' ~/.config/systemd/user/tCMS.service
+	systemctl --user daemon-reload
+	systemctl --user enable tCMS
+	systemctl --user start tCMS
+	loginctl enable-linger $(USER)
+
 .PHONY: test
 .PHONY: test
 test: reset-dummy-data
 test: reset-dummy-data
 	prove
 	prove

+ 9 - 0
service-files/systemd.unit

@@ -0,0 +1,9 @@
+[Unit]
+Description=tCMS
+
+[Install]
+WantedBy=default.target
+
+[Service]
+ExecStart=starman __REPLACEME__/www/server.psgi
+WorkingDirectory= __REPLACEME__/