From e7032a44775a8b9fe7db935a333b21bb74e1a623 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Mon, 02 Nov 2020 19:48:37 +0000 Subject: [PATCH] Create run.sh script and systemd service --- run.sh | 16 ++++++++++++++++ run.service | 13 +++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/run.service b/run.service new file mode 100644 index 0000000..38d6489 --- /dev/null +++ b/run.service @@ -0,0 +1,13 @@ +[Unit] +Description=TTSS update service +After=network.target + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=www-data +ExecStart=/usr/bin/php /path/to/run.sh + +[Install] +WantedBy=multi-user.target diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..2b70223 --- /dev/null +++ b/run.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +DIRNAME=$(dirname "$0") +cd "${DIRNAME}" + +( +flock -n 200 || exit 1 + +while true +do + php download.php + sleep 4 +done + +) 200>./lock + -- Gitblit v1.9.1