From 059d4a664ce8bfcd718410ade8d979807e97332c Mon Sep 17 00:00:00 2001
From: Recolic Keghart <root@recolic.net>
Date: Tue, 18 Feb 2020 08:29:19 -0800
Subject: [PATCH] add extra tools

---
 README.md                    |  4 +++-
 other_tools/ncov-daemon.fish | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100755 other_tools/ncov-daemon.fish

diff --git a/README.md b/README.md
index bfd6b64..d6225fb 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,9 @@
 
 > Tested at Feb 12, 04:03, 2020 (UTC-8).
 
-http://fkfy.hust.edu.cn/jkzksb.htm
+> http://fkfy.hust.edu.cn/jkzksb.htm
+
+Just modify config.py and enjoy!
 
 ## requirements
 
diff --git a/other_tools/ncov-daemon.fish b/other_tools/ncov-daemon.fish
new file mode 100755
index 0000000..22a2a21
--- /dev/null
+++ b/other_tools/ncov-daemon.fish
@@ -0,0 +1,24 @@
+#!/usr/bin/fish
+## This daemon will be autostart-ed on gnome startup.
+## It help you submit ncov in completely automatic way.
+
+while true
+    set fname /tmp/hust-ncov-mark-(env TZ=Asia/Shanghai date +%j)
+    set fails 0
+    if not test -f $fname
+        echo 'CALL HUST-NCOV'
+        timeout 3m /usr/mybin/hust_ncov_submit        
+        and begin
+            echo 1 > $fname
+            echo 'SUCCESS'
+            set fails 0
+        end; or begin
+            set fails (math 1+$fails)
+            echo "fails=$fails"
+            test $fails -ge 14
+                and /usr/mybin/recolic_email_notify root@recolic.net "RECOLIC NCOV NOTIFY" "hust-ncov daily auto submit has been failing for $fails times. Please fix the script!"
+        end
+    end
+    sleep 300
+end
+
-- 
GitLab