Sponsored Content
Top Forums UNIX for Dummies Questions & Answers script to autorestart if uptime greater than... help needed. Post 60321 by alternapop on Friday 14th of January 2005 04:22:50 PM
Old 01-14-2005
Quote:
Originally Posted by bhargav
Complete script ....

if test `uptime | cut -d "," -f 1 | tr -s " " | cut -d " " -f 4` -gt 10 ; then
echo "yes"
fi
sorry but it doesn't work as expected. cut returns "days"

removing the middle part to return the value i'm looking for still doesn't work either:

if test `uptime | cut -d "," -f 1 | cut -d " " -f 4` -gt 10 ; then
echo "yes"
fi

it doesn't return "yes". i'm using bash.
thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calculate server uptime in % (99.98), using ksh script

Let me preface by saying, I have looked through many threads that deal with keep the decimal, however I'm not sure that any one resolution meets my needs, ok, ok, they could. So maybe it's just that I am not understanding the resolution - therefore I am posting a new thread. myknowledgebase=at... (2 Replies)
Discussion started by: cml2008
2 Replies

2. IP Networking

Automate FTP process and autorestart on link failure

Hi Guys, i have this lil challenge; i am to implement an automated script that searches/scans a directory for files then picks and sends this files to a very remote server via an ftp link. the challenge here is that the ftp link fails due to netwrk issues maybe; i therefore need to develop... (5 Replies)
Discussion started by: sdcoms
5 Replies

3. Shell Programming and Scripting

shell script to check file size greater than 50M

Hi All, OS:AIX 64 bits using korn shell. Requirement: shell script to check file size greater than 50M and send mail alert. Thanks for your time! Regards, (3 Replies)
Discussion started by: a1_win
3 Replies

4. Shell Programming and Scripting

linux service script for storing uptime

Hi, Can you please advise a script for the following: write linux service named system_up_duration .This service will create one file named uptime in directory ‘/temp/'. In this file the service will store the total time for which the system is up and running .The file will be updated after... (1 Reply)
Discussion started by: fed.linuxgossip
1 Replies

5. Homework & Coursework Questions

linux service script for storing uptime

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Can you please advise a script for the following: write linux service named system_up_duration .This service... (6 Replies)
Discussion started by: fed.linuxgossip
6 Replies

6. Shell Programming and Scripting

Extract the uptime from the output of the uptime command

Hi! I want to extract the uptime from the output of the uptime command. The output: 11:53 up 3:02, 2 users, load averages: 0,32 0,34 0,43 I just need the "3:02" part. How can I do this? Dirk (6 Replies)
Discussion started by: Dirk Einecke
6 Replies

7. Shell Programming and Scripting

Expect script help needed- script failing if router unavailable

Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK. However, sometimes an... (3 Replies)
Discussion started by: mrkz1974
3 Replies

8. Shell Programming and Scripting

Uptime script

How to write a shell script which can generate server uptime report from the UNIX servers? (3 Replies)
Discussion started by: paventhan
3 Replies

9. Shell Programming and Scripting

Shell Script if $2 is greater than 10 then echo $1

Hi, I have a file output.txt 3258 14 32647 10 32649 10 32650 10 32651 10 32652 10 32653 10 32654 10 32655 10 32656 10 32515 09 32478 08 32555 08 35888 08 (4 Replies)
Discussion started by: amit_spl
4 Replies

10. Shell Programming and Scripting

Script to pull uid greater than 1000 from remote server

Hello, I am trying to get UID # greater than 1000 from all linux server, I tried this script getting this error message, someone please suggest. $for i in `cat hostlist.0709.org` ; do ssh -t $i 'awk -F':' "{ if($3 >= 1000) print $0 }" /etc/passwd ' >> output ; done $ cat output hostname1... (4 Replies)
Discussion started by: bobby320
4 Replies
RUPTIME(1)						    BSD General Commands Manual 						RUPTIME(1)

NAME
ruptime -- show host status of local machines SYNOPSIS
ruptime [-alrtu] DESCRIPTION
ruptime gives a status line like uptime(1) for each machine on the local network; these are formed from packets broadcast by each host on the network via the rwhod(8) daemon. The default broadcast time by the hosts is every three minutes. Machines for which no status report has been received for 11 minutes are shown as being down. The options are as follows: -a Users idle an hour or more are not counted unless the -a flag is given. -l Sort by load average. -r Reverses the sort order. -t Sort by uptime. -u Sort by number of users. The default listing is sorted by host name. FILES
/var/rwho/whod.* data files SEE ALSO
rup(1), rwho(1), uptime(1), rwhod(8) HISTORY
ruptime appeared in 4.2BSD. BSD
August 9, 2005 BSD
All times are GMT -4. The time now is 07:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy