Need Advice for This Programming way


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Advice for This Programming way
# 1  
Old 11-03-2013
Need Advice for This Programming way

Hi All,
I am working in production support environment
And I have a lot of checks done daily on system
And depended on values I take specific decision
I am going to develop script to do general operation task
But my problem is this script will be a running process 24 hours
I need your advice to how to control this script to prevent resource consumption
What is the optimum solution for this
# 2  
Old 11-03-2013
What sort of Checks are you doing what resource consumption are you concerned about?

Do you really need the script to be running 24 hours?
Consider running it periodically throughout the day (e.g. via a cron job every X mins).

Note a script that performs your checks and then sleeps for 10 seconds will consume much less CPU than one that performs the checks continuously.
# 3  
Old 11-03-2013
I doubt you'll find "the optimum solution". You may get hints here and tricks there, but you'll need to put sth together that fits YOUR needs on YOUR system, and constantly monitor, modify and optimize it.

And, if you take specific decisions, that may go beyond every automated system you can install.

You may go with cron running your script every n minutes, or you may have your script run 24 hours but sleep most of the time. Create a fifo pipe, read -t from it with an n minute timeout, and have a case statement execute the commands you pass from the outside to it via the pipe. Write a log file, and tail -f it to see what's up and react if need be.
# 4  
Old 11-05-2013
hi all
simple what i want to to
my system checks
1) disk storge
2) DB listener
3) weblogic application status
4) SQL querey run every day to give some report
etc

OS: linux redhat enterprise

what i want to do
i have already have cronjob for each task of these and sent descriptive email to me after finish
instead of lots of cronjobs i want to create shell script program run 24 hour
because i have checks run every 15 min and 20 min and 30 min and every one hour and every 4 hour


what i am afraid of
1) face before script hang in run time
2) face before script take a large amount of resources when i do it as loop to be always run

my question is
i will going to program Intelligence brain of operation depend on specific factor
that will take Decision
depend on your experience in programming
is that any recommendation to do that
is that good solution


and i need to avoid process out of control
control resource consumption
control process hang
reach the normal solution



i am not asking how to do that i am asking about the possibility to do is shell script already have this flexibility to use or perl script better

what is the best way of programming to do that
functions - case statement - ............. etc

is that good to start this work or is that effort without value

Last edited by maxosmanpad; 11-05-2013 at 10:58 AM..
# 5  
Old 11-05-2013
From you description I get the impression that the script you describe is going to end up unnecessarily complex. You have various different checks running at different intervals that may even overlap resulting in two or more running simultaneously.

My thoughts are - that using separate cron jobs has a number of advantages:

Cron method is standard and well documented, so later down the track other admins will find it much easier to adjust or add to.

You will still need something to ensure your 24hour job is started and continues to run, if one of the cron jobs fails it will always be run again on it's next scheduled time.

You can check in each cron job to ensure the previous call isn't still running and alert if this is the case. This helps you to catch runaway processes quicker.

You will end up with a number of simpler and easier to maintain scripts. This hybrid 24hour script has so many more points of failure.
# 6  
Old 11-06-2013
many thanks Chubler_XL for your advice
i am totally understand your points
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Permission problem, programming advice needed, Perl

Hi all, I have written a wrapper script in Perl which will be used on AIX, Linux and Windows and I do not want to change any code for the needs for a specific OS if avoidable. It works fine so far on all 3 OSes, not blowing up any stacks any more, but I am unsure how to handle writing log files... (7 Replies)
Discussion started by: zaxxon
7 Replies

2. UNIX for Dummies Questions & Answers

From iOS programming to Linux system programming

Hello. I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations: 1. Linux and iOS are UNIX-like systems, POSIX compliant. 2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 Replies

3. Programming

System + Network Programming, your advice required???

Dear friends, Before putting my questions forward, I would like to put some data infront of you, hope you will help me at the end. This website Cray-Cyber - Welcome provides free access to many supercomputers and mainframe computers. When you login through ssh, they provide you with a screen,... (5 Replies)
Discussion started by: gabam
5 Replies

4. UNIX for Advanced & Expert Users

System + Network Programming, your advice required???

Dear friends, Before putting my questions forward, I would like to put some data infront of you, hope you will help me at the end. This website Cray-Cyber - Welcome provides free access to many supercomputers and mainframe computers. When you login through ssh, they provide you with a screen,... (0 Replies)
Discussion started by: gabam
0 Replies

5. Shell Programming and Scripting

Need Advice

Guys, Can you tell me what value would additional knowledge of PERL and CGI scripting will add to my skill set of UNIX shell scripting and ORACLE PL/SQL? I understand that PERL is a good tool for text processing. (1 Reply)
Discussion started by: yabhi_22
1 Replies

6. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

7. Programming

C Programming - Hardware Programming

Can someone help me on suggesting some ways to access the memory content in RAM directly from C/C++ source code. Please provide me any book name or any URL so that I can get an exhaustive knowledge over it. If possible please give me some tips on interacting with hardwares directly through... (3 Replies)
Discussion started by: nandumishra
3 Replies

8. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

9. Programming

c programming or unix programming!?

i would like advice on the usbject of c programming (in the middle of reading a book on C). could i benefit more if i apply that knowledge in the unix format if i were able to, or would that take the point out of learning C, basically I want to stay away from strying too far away from unix and use... (1 Reply)
Discussion started by: moxxx68
1 Replies

10. Linux

programming advice needed....

i'm a grad student taking a UNIX course and a networks course (i have a background in C++ and JAVA). i'm trying to combine the two classes. My questions stems from a networks programming homework assignment below: "Using the operating system and language of your choice, develop a program to... (5 Replies)
Discussion started by: trostycp
5 Replies
Login or Register to Ask a Question