Make client MacOS devices restart after running for x days
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-29-2019 09:58 AM
!/bin/sh
Set UPTIME output for echo
UPTIME=uptime | cut -d ',' -f 1
clip the number of days of uptime and set as variable Days
Days=echo $UPTIME | cut -d ' ' -f 3
Check that second step is cutting correct field
echo $Days
Set the max number of days of uptime to Parameter 4
RUNNING=$4
if [ $Days -gt $RUNNING ]
then
shutdown -r now
fi
Labels:
- Labels:
-
Scripts
0 REPLIES 0
