Command That Gives Booting Times


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command That Gives Booting Times
# 1  
Old 10-22-2010
Command That Gives Booting Times

hi friends,
ım new in shell scripting and ı want to know that which commands gives the booting times in fixed time interval(day) ı have entered.
For Example,
When ı enter 4 for command,
Command will return the booting times in last 4 days.

Thank for your helps!!!
# 2  
Old 10-22-2010
There is no single command in any unix or Linux Operating System which will give you this information.

In some Operating Systems this is easy and in some Operating Systems this is impossible.

What Operating System do you have?
What Shell do you prefer?
# 3  
Old 10-22-2010
I don't understand what you mean by booting times.

The uptime command tells you how long it has been since the system booted (i.e. how long it has been up).

Or do you mean you want to know what commands have been run in the last 4 days?
The history doesn't give you exactly that, but it may be helpful.
Try something like this:
Code:
history | grep ls

# 4  
Old 10-22-2010
Code:
who -b
uptime

are tow possible commands. The information is stored in either wtmp or wtmpx - usually in var/adm/[filename]. Previous boot times may or may not be there.
# 5  
Old 10-22-2010
None of the above will give you the recent boot history of a unix server.
"who -b" and "uptime" refer to utmp which contains only the current boot.

Please answer post #2 .
# 6  
Old 10-23-2010
Quote:
Originally Posted by methyl
There is no single command in any unix or Linux Operating System which will give you this information.

In some Operating Systems this is easy and in some Operating Systems this is impossible.

What Operating System do you have?
What Shell do you prefer?
Im using Ubuntu. My aim is just to list boot times in time interval which ı have entered. Can ı specialize last command? I can list boot times by using last command but as ı said ı want to see boot times in last 3 days for example.
Thank for your helps...
# 7  
Old 10-23-2010
solve

Quote:
Originally Posted by deco
Im using Ubuntu. My aim is just to list boot times in time interval which ı have entered. Can ı specialize last command? I can list boot times by using last command but as ı said ı want to see boot times in last 3 days for example.
Thank for your helps...
probably we are at the same class with this guy. he is trying to say this problem..

(20 pts) Write a shell script which includes a single argument which is a number.
Then, it will show the number of times that the computer was booted during last “number” of days
(including today).
Hint: This information is recorded somewhere in your system.
$myprog3 3
13/10/2010 booted 5 times
12/10/2010 booted 2 times
11/10/2010 booted 0 times

I solved the problem with my way. I took into array "last reboot" command. and i got the the day and month lines into process. than checked them how many times repeated and to limit the input counter, i checked today "%d" .

"kolay gele.."
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command to replace one value which occurs multiple times

Hi, My Input File : "MN.1.2.1.2.14.1.1" := "MN_13_TM_4" ( 000000110110100100110001111110110110101110101001100111110100011010110111001 ) "MOS.1.2.1.2.13.6.2" := "MOS_13_TM_4" ( 000000110110100100110001111110110110101110101001100111110100011010110111001 ) Like above template,I have... (4 Replies)
Discussion started by: Preeti Chandra
4 Replies

2. Red Hat

Systemd booting and execute system command is Not successful!help!

hi guys, booting centos7 and use systemd execute system command ulimit -SHn 202400 is fail.i dont know what's reason.can you give me help. ------------------------------------------ set-ulimit.service Description=test service After=systemd-update-utmp-runlevel.service #the last... (1 Reply)
Discussion started by: shean
1 Replies

3. SCO

Booting to Command Prompt

Hello, I need help booting to a command prompt. The server runs SCO Openserver 5.0, with a point of sale program that automatically boots upon startup. I can't gain root access, and the administrator password for the point of sale program is un-obtainable. I am upgrading to a new point of sale... (8 Replies)
Discussion started by: tedcurvin
8 Replies

4. Shell Programming and Scripting

Script runs in command-line fine but times out in CRON?

Hi, I have a script that seems to run to completion when in the command-line, but when it is run using the cron, it seems to time out. They both start and run fine, but on the CRON it stops prematurely. The script hits an API every few seconds and grabs data. Does anyone have any idea on... (4 Replies)
Discussion started by: phpchick
4 Replies

5. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

6. Shell Programming and Scripting

How to implement a command n times?

I need to run a command n (n >= 100) times and the command running may take about 30 seconds. Can anyone help me with the shell script to achieve this? Thanks in advance. (5 Replies)
Discussion started by: zwei2011
5 Replies

7. Shell Programming and Scripting

Run .command at specific times

Okay so I've got a command to start my java server up, but I want it to start at say 8:00AM and then stop at 11:00PM. In order to stop it I have to type stop and press enter in the terminal. I've been trying to get this to work and I'm having no luck. Here's my command: #!/bin/bash cd "`dirname... (2 Replies)
Discussion started by: JustChillin1414
2 Replies

8. AIX

how would you know your server was rebooted 3 times or 5 times

Is there such location or command to know how many times did you reboot your server in that particular day?in AIX. (3 Replies)
Discussion started by: kenshinhimura
3 Replies

9. Solaris

booting from CD

Hello.. I am Still Learing Solaris .. when i try to Install Solaris 8 from its CD...i pressed STOP + A and i get a OK prompt screen. I then typed, "boot cdrom" and i am getting this error message. " FATAL: system is not bootable, boot command is disabled." How do we enable the boot... (5 Replies)
Discussion started by: vr76413
5 Replies

10. Shell Programming and Scripting

How to make my command work at all times

hi all, This is a very basic question. I want to make the command work at all times. i'm working on Suse-Linux and "clear" command is used to clear the contents of screen. I want to use only "cls" instead of "clear" command. i tried alias cls=clear , but its working only for a temporary... (3 Replies)
Discussion started by: wxwidgets
3 Replies
Login or Register to Ask a Question