[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script for when system was last updated (Resolved)



On Tuesday 03 June 2008 14:12, Nigel Henry wrote:
> On Monday 02 June 2008 22:57, Mumia W.. wrote:
> > On 06/02/2008 01:14 PM, Nigel Henry wrote:
> > > [...]
> > > Could someone suggest a script I could put in ~/.kde/autostart that
> > > would put up an xmessage saying when the system was last updated, when
> > > I boot up Lenny?
> > >
> > > Much appreciation to all you scripting gurus out there.
> > >
> > > Nigel.
> >
> > I'm hardly a scripting guru, but this may help you a bit:
> >
> > #!/bin/bash
> > hist_files="$HOME/tmp/tmp/history-files"
> > lastupd=`ls $hist_files | sort -n | tail -1`
> > xmessage "The system was last updated on $lastupd"
>
> Hi. Thanks for the little script. I have a problem understanding the
> hist_files= line. The xmessage just says "The system was last updated on",
> and no date of the lastupdate is mentioned.
>
> I ran ls /home/djmons/History-files | sort -n | tail -1, and the date of
> the latest file is printed out in the shell, so that bit is working ok.
>
> I did change history-files to History-files on the hist_files= line, to
> reflect the correct name for the directory where the history files are
> kept, but no change. What does the /tmp/tmp signify on that line. It seems
> as if the path to where the history files are is not correct.
>
> Nigel.

Well, I appear to have resolved the problem by commenting out the hist_files= 
line, and changing the lastupd= line, as below.

lastupd=`ls /home/djmons/History-files | sort -n | tail -1`
xmessage "Last updated on $lastupd"

Now the xmessage displays correctly with the date of last update.

Thanks for the help with the script.

Nigel.


Reply to: