1

I'm currently trying to get a missing cronjob runner script thing to work, but it was written for Arch Linux, which is pretty different from Mac OS X, and one of the things that it tries to do is run last -x, which fails since Mac's version of last doesn't include a -x option.

According to About.com -x displays the system shutdown entries and run level changes. Is there any way to emulate this behavior in Mac OS X?

Here's an excerpt from the man page for last on Ubuntu Linux:

excerpt from the man pager for last on Ubuntu

1 Answer 1

2

Is the following sufficient?

uname -a
Darwin Macmini-i53.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64

last | grep -e boot -e shut
reboot    ~                         Mon Dec  2 09:57 
shutdown  ~                         Mon Dec  2 09:54 
reboot    ~                         Fri Nov 29 12:45 
shutdown  ~                         Fri Nov 29 12:40 
4
  • 1
    The most general and simple answer looks like: last reboot shutdown.
    – dan
    Dec 2, 2013 at 21:59
  • I need both system shutdown entries and run level changes, I checked the Mac OS X man page for last, but I didn't see anything that'd let you see runlevel changes. Dec 23, 2013 at 17:18
  • 1
    BSD variants don't use the concept of run levels.
    – Matteo
    Dec 23, 2013 at 17:33
  • @Matteo as it turns out, I didn't reall need the -x the script I've been trying to port from Linux to Mac OS X didn't even use the runlevels, it immediately piped the output from last to grep, like so last -x | grep -m 1 shutdown Dec 24, 2013 at 20:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .