-   Linux - Newbie (
-   -   Linux shell scripting on cluster using sun grid Engine (

Kabelom 07-27-2009 03:21 AM

Linux shell scripting on cluster using sun grid Engine
Good day ..i am a student and i am been trying to experiment by writing a shell scripting using SGE commands & awk &sed commands without any success .the script has to output system statistics eg the types of queues (Jobs Available,Jobs Waiting ,Jobs Errors) and the quota has to display when the user log on the cluster .it has to be a summary ..the main aim the user doesnt have to use qstat command when he is on the cluster ,the script has to simplify the users work

even if the script doesnt use other commands as long i can try to get ideas or script that can give me the output i want ..please help

David the H. 07-27-2009 04:46 AM

Please don't make multiple posts. Choose one forum that you think best fits your topic. If you've accidentally posted to the wrong forum, use the "report" button and ask a moderator to move it for you.

Second, you need to provide some details. At the very least post the relevant parts of the script you're working on. Since this appears to be a homework assignment, you're not going to get any spoon-fed answers, but we can help guide you to a working solution.

Kabelom 07-27-2009 04:59 AM

My script that i wrote
Thanks for the guidance ,its my first time posting a question.Secondly its not a school assignment,its sumthing (little Project) i am trying to work on to help me learn Shell scripting ,Linux and Sun Grid Engine

#! /bin/sh
#$ -S /bin/bash

echo "= WELCOME TO C4 ="
qacct -q
qacct -o

qacct -A -b
qacct -slots
qstat -g c -l arch=lx24-amd64 -q all.q | awk 'NR > 2 {sum = sum + $4} END {print sum}'

qstat -r
qstat -t
qstat -u '*'
qstat -explain E
qstat -u sjf4

qstat -f
qstat -u kmahloane
qstat -j

qstat -g c

quota -u kmahloane
quota -u '*' -P '*' -q '*'

qconf --sconf
qconf -srgsl
qconf -args
qconf -srgs

David the H. 07-27-2009 09:14 AM

Please put large blocks of code inside [code][/code] tags, so that the formatting doesn't get lost and it doesn't break the layout of the page.

Now I have no experience with qstat (or any of the others you're calling) or what the output looks like. I'd have to see some example output in order to fully understand what you're trying to extract.

But from a first glance, it looks like you're calling these various "q*" commands over and over again in order to get different values. I think, if it's possible, that it would be much more efficient to get all of your output at once and store it in a variable or two (or perhaps an array). Try to combine as many operations as possible into a single command. Then you can parse those variables for the information you want and store the values in variables too. Then you can create a final output form that will print those variables in a readable fashion. You might want to create separate functions for each of these processes.
