Skip to content

(BOLT-459) Create reboot plan #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 19, 2018
Prev Previous commit
Next Next commit
(BOLT-459) Add tasks to get last boot time
  • Loading branch information
MikaelSmith committed Nov 16, 2018
commit 63794fb884c0f3eda8dfd590f88fa03a566d6ecc
7 changes: 7 additions & 0 deletions tasks/last_boot_time.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"description": "Gets the last boot time of a Linux or Windows system",
"implementations": [
{"name": "last_boot_time.sh", "requirements": ["shell"]},
{"name": "last_boot_time.ps1", "requirements": ["powershell"]}
]
}
3 changes: 3 additions & 0 deletions tasks/last_boot_time.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$boot = Get-WmiObject -Class Win32_OperatingSystem
$dt = $boot.ConvertToDateTime($boot.LastBootUpTime)
Write-Output "$($dt.ToShortDateString()) $($dt.ToShortTimeString())"
6 changes: 6 additions & 0 deletions tasks/last_boot_time.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
if [ $(uname) = Darwin ]; then
last -1 reboot
else
last -1 -F reboot
fi