File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -89,9 +89,10 @@ Additional information for the following roles:
89
89
* technically there are built-in methods to run apt and snap update daily
90
90
(unattended-upgrades), however, none of those methods seem to work.
91
91
This primitive implementation achieves a similar effect.
92
- * This role is for any desktop/laptop that requires operating 24/7.
93
- * unfortunately there is no method to ensure reboots are triggered when
94
- required
92
+ * This role is for any desktop/laptop that operates 24/7.
93
+ * There is a basic script to check if a reboot is required,
94
+ which is scheduled to run daily at 0400hrs.(checks for presence of
95
+ /var/run/reboot-required)
95
96
96
97
* aws
97
98
* installs [ AWS CLI v2] ( https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html )
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ LOG_FILE=" /var/log/reboot_check.log"
4
+
5
+ if [ -f /var/run/reboot-required ]; then
6
+ echo " Reboot required on $( date) " >> " $LOG_FILE "
7
+ # Uncomment the next line to automatically reboot
8
+ /sbin/reboot
9
+ fi
Original file line number Diff line number Diff line change 48
48
mode : ' 0644'
49
49
modification_time : preserve
50
50
access_time : preserve
51
+
52
+ - name : Copy the reboot check script to the server
53
+ copy :
54
+ src : " check_reboot.sh"
55
+ dest : /usr/local/bin/check_reboot.sh
56
+ owner : root
57
+ group : root
58
+ mode : ' 0755'
59
+
60
+ - name : Schedule cron job to run the reboot check at 0400hrs daily
61
+ cron :
62
+ name : " Check if reboot is required"
63
+ minute : " 0"
64
+ hour : " 4"
65
+ job : " /usr/local/bin/check_reboot.sh"
You can’t perform that action at this time.
0 commit comments