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

Re: Script to build system information. Guru needed :)



On Tue, 2004-12-21 at 18:30 +0100, Bob Alexander wrote:
> Slowly building my "disaster assurance" strategy on top of the file backups.
> 
> Amongst other things I want to periodically run a shell script that 
> would build a file with useful information. Here it is:
> 
> lsmod
> lspci
> dpkg --get-selections
> sudo fdisk -l /dev/hda
> df
> uname -a
> 
> Now the questions:
> 
> 1) Other useful commands I am not thinking about ?
> 2) I would like to redirect the output to a file called with the 
> catenation of 'uname -n'.'uname -r'.config.YYYYMMDDHHMM.txt where 
> YYYYMMDDHHMM is a timestamp of the command execution time. How do I 
> obtain such value ?

$ date +%Y%m%d%H%M

>  How do I create the required backticks on my laptop 
> keyboard (no separate numpad)

Umm, don't know your laptop works.

But....  There is a solution!!  `foo` is now the non-approved 
method, and $() is now what the bash folks want us to use.

$ ts=$(date +%Y%m%d%H%M)
$ echo $ts
200412211158

> 3) If I use cron to run this everyday, being this a laptop client, will 
> the due command be executed if it's natural time has expired ?
> 4) What is the easiest way to keep the last N versions of such files ?
> 
> TIA,
> Bob
> 
> 

-- 
-----------------------------------------------------------------
Ron Johnson, Jr.
Jefferson, LA USA
PGP Key ID 8834C06B I prefer encrypted mail.

"Rightly hating violence, [pacifists] do not wish to recognise
that it is integral to modern society and that their own fine
feelings and noble attitudes are all the fruit of injustice
backed up by force. They do not want to learn where their incomes
come from."
George Orwell

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: