From 049bb50aaf031a732751c9d3641fceeb1573f025 Mon Sep 17 00:00:00 2001 From: JanssenSimon <32472583+JanssenSimon@users.noreply.github.com> Date: Wed, 19 Oct 2022 21:37:16 -0400 Subject: [PATCH] Adds creation of systemd daemon for running script on startup --- wimp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wimp b/wimp index 24b5b0e..416a922 100755 --- a/wimp +++ b/wimp @@ -6,8 +6,24 @@ wimp_create_directories() { touch ./includes/before.html; touch ./includes/after.html } # checks if the watch function is going to be run on startup using systemd +#TODO bug to fix here with path of script +#TODO check if file exists before doing this whole thing +#TODO change this so that it works with multiple directories wimp_create_daemon() { - echo "TODO create daemon" + touch /etc/systemd/system/wimp.service + echo "[Unit] +Description=Run wimp website generator + +[Service] +Type=simple +RemainAfterExit=yes +ExecStart=$(pwd)/wimp +TimeoutStartSec=0 + +[Install] +WantedBy=default.target" > /etc/systemd/system/wimp.service + systemctl daemon-reload + systemctl enable wimp.service } # compiles mardown file in src to html file in public using pandoc wimp_compile() {