ps aux + grep + nice + while


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ps aux + grep + nice + while
# 1  
Old 11-23-2012
CPU & Memory ps aux + grep + nice + while

Hi again, well does anyone knows how can i grep a process that right know the only part of the process name that i know is "backup" then renice it if the cpu consumption is more then 90% ...

for now i have :

Code:
a=$(ps aux | grep -c backup )

while  $a > 2 #pseudo code
do 
    if [ $cpulevel gt 95 ]; then # grab the cpu consumption for the task ?? lol TOP maybe


    renice ... # this is were i really dont know how im gonna grab the pid maybe awk
                  # and lower the priority of the backup task
    
    fi

done

# 2  
Old 11-23-2012
IMHO It is not a good idea... For you may end with backups never completing...
With time passing all processes loose importance ( automatically the privileges are lowered ) after a well quite some time if your backup is still running, its new privilege will avoid the backup to complete itself... I already saw that on 2 sites so far... ( without anybody noticing... I happened to be called for an issue on a weekend and when tried to restore, I looked at 70 tapes...)
# 3  
Old 11-23-2012
yeh i understand but that is on server that i need to keep track of logs, the backup task ( c0ded by the product team ) is single core so doesnt try to balance itself in the server resources ... that was the only solution i thought
# 4  
Old 11-23-2012
What kind of backup tool are you dealing with? Why is the server so loaded at backup time?
# 5  
Old 11-23-2012
IDS - Large stream of data coming in , at in a certain period of time in the night the task backup starts and i receive a spike cpu load alert that makes me always check for possible DDoS on our servers etc
# 6  
Old 11-23-2012
But what kind of backup? What is your backup tool?
an IDS should not run during backup, meaning to be safe you should have two net interfaces configured one for appl etc... the other for technical purpose (maintenance, backup) and when backup runs disable the open (appl ) network interface ( you use now the private technical...) and so you can put to sleep during backup your IDS
# 7  
Old 11-23-2012
well the tool is integrated on the ids tools is Backup script that in a basic resume logs in zips and send it by ssh to the backup server from the main server ( the one that receives the traffic and analyze it ) .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find the exact process using ps aux command?

Please do not post a technical question in the @How to contact....' forum. I have moved this for you. Hello Everyone, Please help me on this, Requirement here is to check whether the process is running using the process id. For the below scenario, I m trying to grep 1750 process id to... (3 Replies)
Discussion started by: Hari A
3 Replies

2. Shell Programming and Scripting

Get PID Number from “ps aux --sort -rss ”

Hi everyone How can I just get the PID of the following command: ps aux --sort -rss Thanks Regards (2 Replies)
Discussion started by: anonymuser
2 Replies

3. AIX

Run ps aux continuously in AIX

Requirement is to monitor cpu usage /process for a user given time and record the output. topas,topasout,topasrec,tprof not seems to be working for me. so what i am looking for is to run below command continously till the time limit given by the user who runs the script.since below command is a one... (6 Replies)
Discussion started by: NarayanaPrakash
6 Replies

4. Shell Programming and Scripting

Extract a column from ps -aux command

Hi, I have the following output : root 9296 81.7 0.2 1115328 20856 ? Sl 14:38 1:00 /opt/h264rtptranscoder.bin --videoPort=14500 --audioPort=14501 --serverPort=14500 --framesPerSecond=50 --profilesPath=/opt/transcodingProfiles I would like to have the following output : ... (6 Replies)
Discussion started by: liviusbr
6 Replies

5. AIX

Difference between ps -ef and ps aux

Hi, Can someone tell me what the difference is between ps -ef and ps aux. I was under the assumption that both commands would list ALL processes currently running on the system. But on my server I find the following: # ps -ef | wc -l 519 # ps aux | wc -l 571 What... (1 Reply)
Discussion started by: petervg
1 Replies

6. Shell Programming and Scripting

Need to get the list of file with size in AUX

to get the list of file name with size Example: rwxrwxrwx 1 cm x 562KB Nov 6 19:22 a rwxrwxrwx 1 cm x 562MB Nov 6 19:22 a edit by bakunin: Please view this code tag video for how to use code tags when posting code and data. (5 Replies)
Discussion started by: Jewel
5 Replies

7. Programming

nice command and nice() system call

Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command... (2 Replies)
Discussion started by: tejbuch
2 Replies

8. UNIX for Dummies Questions & Answers

ps aux|grep getty

what is the aim of this command: ps aux|grep getty (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies

9. UNIX for Dummies Questions & Answers

PS -aux and PS

I am new to the Unix. Can someone tell me what is the difference between 'PS' command and 'PS -aux"? Isn't 'PS' mean the current running process? Isn't 'PS -aux' mean the current running process too? If they are the same, how come 'PS -aux' always has a lot more listing than 'PS'? Thanks, (4 Replies)
Discussion started by: a2715mt
4 Replies

10. Post Here to Contact Site Administrators and Moderators

Very Nice

Just a quick message to say great work to Neo and any others who have helped with the upgrade - the layout, appearance and functionality of this forum ROCKS. By far the best I have seen. Excellent! (1 Reply)
Discussion started by: alwayslearningunix
1 Replies
Login or Register to Ask a Question