LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-22-2016, 04:53 AM   #1
sub320
Member
 
Registered: Jan 2016
Posts: 40

Rep: Reputation: Disabled
Script to check progess


deleted

Last edited by sub320; 01-26-2016 at 09:18 PM.
 
Old 01-22-2016, 05:36 AM   #2
huffdad
Member
 
Registered: Jan 2006
Location: Missouri
Distribution: Slackware & LFS
Posts: 31

Rep: Reputation: 6
I'm not sure the answer to this question, but since you're asking about scripts, this page may be useful to you:

http://linux.die.net/abs-guide/
 
Old 01-22-2016, 05:40 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,243

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
I would suggest looking at cron, as timed functions are its thing
 
Old 01-22-2016, 06:21 AM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,252

Rep: Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559
cron is best for background jobs, try watch
Code:
man watch
 
Old 01-22-2016, 11:58 AM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: SATX
Distribution: RHEL/CentOS
Posts: 1,166
Blog Entries: 4

Rep: Reputation: 131Reputation: 131
Quote:
Originally Posted by sub320 View Post
I have a script called my_script to check the number of process is running , the result is a number .

I would like to write a script to run this script in every 30 seconds , then output the result to a file , the format is as below .

Code:
Time			Number of process
====			=================
09:00:00			50
09:00:15			70
09:00:30			152
09:00:45			58					
09:01:00			243	
"
"
Would advise how to write such script ?

Thanks
Agreed on watch command.

Code:
watch -n 30 ./my_script >> results.txt
This is something pretty basic to get started.
 
Old 06-17-2016, 04:37 AM   #6
ph4ntom
LQ Newbie
 
Registered: Jan 2010
Posts: 1

Rep: Reputation: 0
Also, I have a question that I would appreciate help with.

I need to check for a process every 20 seconds but I need to send the output of to a centralized log system.
For example, how could I achieve this lets say with Nagios? Would watch be the answer? Does watch have to be combined with cron or something?

Help is very much appreciated!

Note: Can someone share the simple watch script please, posted above?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script to check if file is present or not, check periodically every 30 mins Iyyappan Linux - Server 10 07-03-2013 06:19 AM
Script to check PID from file and check whether process is running or not rajkiran183 Linux - Newbie 5 10-19-2012 12:28 PM
How to check that my script can check if it has a specific range of charcters. shirlcurl20 Linux - Newbie 2 11-17-2010 12:15 AM
Please Check Script ehegagoka Slackware 3 02-13-2007 08:44 AM


All times are GMT -5. The time now is 10:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration