There's also `last reboot -1`, add your favorite timestamp format with -T :)


Rob Nelson
rnels...@gmail.com

On Fri, Jan 13, 2017 at 6:27 AM, Thomas Müller <tho...@chaschperli.ch>
wrote:

>
>
> Am Dienstag, 10. Januar 2017 17:44:23 UTC+1 schrieb Denny:
>>
>> Hi there,
>>
>> probably a pretty easy to answer question.
>>
>> I want to try out adding custom facts. My first custom fact should be
>> "lastrebootdate"
>>
>> My code looks like this:
>>
>> Facter.add(:lastrebootdate) do
>>   setcode do
>>     Facter::Util::Resolution.exec("/usr/bin/who -b |awk '{print $3}'")
>>   end
>> end
>>
>> Running the command on the system returns "2017-01-30"
>>
>>
>>
> just a random thought: instead of calling who you could take the already
> existing uptime fact and just calculate the date with ruby time/date
> functions.
>
> - Thomas
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/41898ce0-c5e3-472f-98f9-eb4fbae47aa8%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/41898ce0-c5e3-472f-98f9-eb4fbae47aa8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAC76iT9-egYN4OeKg9qk%3DrwxMhRPgON-UMxyPRKvZJPvt%3DikVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to