Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: Disabled
Script to check progess


Last edited by sub320; 01-26-2016 at 09:18 PM.
Old 01-22-2016, 05:36 AM   #2
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:
Old 01-22-2016, 05:40 AM   #3
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,552

Rep: Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899
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,473

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

Rep: Reputation: 132Reputation: 132
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 .

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 ?

Agreed on watch command.

watch -n 30 ./my_script >> results.txt
This is something pretty basic to get started.
Old 06-17-2016, 04:37 AM   #6
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?


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 > Forums > Linux Forums > Linux - Newbie

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

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