Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About script, urgent!!! 1

Status
Not open for further replies.

sri8217

MIS
Oct 24, 2007
5
US
hi folks,
i am new to this forum...can u help me out.i need a script that is most urgent.
i need a script that login to the tsm with userid and password and check for the process (that backups mostly "GENERATE") is running or not.if its running then check after some time (like 10 mins)
.then check again if is stopped then return code 0.

that is the thing i really wanted urgent, can u guys plz help me out. i need to show tommorow.

thanks in advance

regards,
sri8217.
 
Hi sri,

From where exactly you will login to the tsm? from a windows machine or from an aix box?

Regards,
Khalid
 
Good Morning,

here's something that might give you an idea on how to script what you need (You'll have to modify it a bit according to your needs):

------------------------------------------------------
#!/usr/bin/ksh

i=1
while (i=1)
do

dsmadmc -id=user -password=password "q pro" | grep searchterm

if [ "$?" = 0 ]; then
echo "Process is running"

-> here you can send an email, put the info in a log file or whatever you want ...

else

echo "Process is NOT running"

-> again, here you can perform any action you like ...

fi

sleep 600
done
------------------------------------------------------


Regards
Thomas
 
hi,
which action, the script, has to take
if the process is not running:

- send a e-mail
- try to restart
- send an sms to you !

Have you thinked to run this script by cron ?

If you use crontab, you may put the script in the
crontab oh the specific user (with parameters to run every 10 minutes), without needing to login.

bye
vittorio
 
Hi khalid,
want to login from aix box.

Hi Thomas,
u helped me alot.and one more thing, running script in a loop, is there any chance that take resources more.
and if ever want to stop a script, how do i?

Hi vittorio,
if process is running, then return code 0 to Control M scheduling, if not return 4.
i will try script now, which is the best procedure to run on crontab or looping script?

reply me back,
thanks in advance.

regards,
sri.
 
Hi Sri,

you shouldn't get any problems with resources. The script is kind of "idle" for 10 Minutes and every 10 Minutes it issues a "small" command ...

To stop it just do a

ps -ef | grep scriptname

and

kill "process number"

(Just be sure not to kill the parent process because the ps command shows you both numbers)

or if you didn't start the script in background just press

<CTRL> + <C>

Regards
Thomas
 
thank you thomas.i appreciate ur help.

regards,
sri
 
hi sri,

technically speaking 2 modes are indifferent: the use
of 1 or 2, depends from the use you want do, what you need.

I should use a loop-script if I think to check (if
the process is alive) sometime and I want to interrupt
it any time.

Instead if the test has to run always, without my presence,
and it has to e-mail or log in a file, I'd use crontab.

Crontab is a little difficult to test, but you can run, at
test time, the script manually.

If you use a manually launched script, you can use a semaphore: a file with its presence or its data, tells to the script to stop (if file is missing or its first line is 0); using this file, you can put inside also the interval,
or anything you will think in future.

With a little script (s2), you launch the main script (s1)
enternig a choice [0]=START (this launch the script, write
the semaphore file, with a parameter 1 (first line) to run, with a parameter 2 (second line) default sleep time;
choice [1]=STOP, will write a 0 in the first line;
choice [2]=MODLSP, will write what you want in th 2nd line;

The main script (s1) has to read the semaphore file, each loop and interpretate its data

These are SundayMorning ideas ...

ciao
vittorio





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top