瀏覽代碼

Scripts and crontab to manage autoupdates

DricomDragon 5 年之前
父節點
當前提交
f817f1e15f
共有 3 個文件被更改,包括 34 次插入0 次删除
  1. 14 0
      Cron/boot_system
  2. 4 0
      Cron/pi_root_crontab
  3. 16 0
      Cron/reboot_system

+ 14 - 0
Cron/boot_system

@@ -0,0 +1,14 @@
+#!/usr/bin/fish
+
+# Warn that system reboots and prints logs in jovian home
+## Should be executed as super admin
+
+function printStep
+	echo '-  -  -  -  -'
+	echo "Step $argv"
+	echo '-  -  -  -  -'
+end
+
+printStep 'Rebooted'
+date
+echo 'Script has ended'

+ 4 - 0
Cron/pi_root_crontab

@@ -0,0 +1,4 @@
+# m h  dom mon dow   command
+0 3 * * * /home/jovian/Cron/update_system > /home/jovian/Cron/logs/update_system_log.txt 2> /home/jovian/Cron/logs/update_system_error.txt
+0 3 * * 4 /home/jovian/Cron/reboot_system > /home/jovian/Cron/logs/reboot_system_log.txt 2> /home/jovian/Cron/logs/reboot_system_error.txt
+@reboot /home/jovian/Cron/boot_system > /home/jovian/Cron/logs/reboot_system_log.txt 2> /home/jovian/Cron/logs/reboot_system_error.txt

+ 16 - 0
Cron/reboot_system

@@ -0,0 +1,16 @@
+#!/usr/bin/fish
+
+# Reboot the system and print logs in jovian home
+## Should be executed as super admin
+
+function printStep
+	echo '-  -  -  -  -'
+	echo "Step $argv"
+	echo '-  -  -  -  -'
+end
+
+printStep 'Start'
+date
+
+printStep 'Reboot'
+systemctl reboot