Check if a program runs on unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check if a program runs on unix
# 1  
Old 05-21-2007
Check if a program runs on unix

Hi guys, I had a question last week where I asked how I check from a website hosted on windows if a process is running on on of our unix servers. Vino and Shell Life kindly replied with a perl script:

if [ $(ps ef | grep '[m]qm') -gt 0 ] ; then
echo "Site is up"
else
echo "Site is down."
# start the server.
fi;

Now to run this script, I would need to telnet into unix and i found the following script:

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>10,
Errmode=>'die');
$telnet->open(unix);
$telnet->waitfor('/login: $/i');
$telnet->print('admin');
$telnet->waitfor('/password: $/i');
$telnet->print(pass');
$telnet->waitfor('/\# $/i');
$telnet->print('who');
$output = $telnet->waitfor('/\# $/i');
print $output;

So how do I merge these two and run the script from a website?

Thank you in advance
Chris
# 2  
Old 05-23-2007
just reposting in case someone can help

thanks guys Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Where can I find the program that runs the -wc command?

Hey guys, I was wondering. When I enter a command in the terminal -wcl for a word count, where is that program located in the kernel? (7 Replies)
Discussion started by: Circuits
7 Replies

2. Homework & Coursework Questions

create a program that runs two processes linked oven

I need help program in C... :create a program that runs two processes linked oven (1 Reply)
Discussion started by: gizmo16
1 Replies

3. Shell Programming and Scripting

crontab runs only one line in iterated program

I have a crontab as below: PATH=/usr/local/sbin:/bin/:..... etc etc 0 8 * * * /home/user/jobs/poll.sh 2>/dev/null 1>/dev/null Now the script poll.sh is called at correct time and executes. This is how poll.sh looks like #!/bin/bash... (2 Replies)
Discussion started by: chakrapani
2 Replies

4. Programming

In unix how we can test or check race condition in a c program by using multi threads

In unix how we can test or check race condition in any c program by using multi thread programming (1 Reply)
Discussion started by: afroze
1 Replies

5. Programming

In unix how we can test or check race condition in c program by using multi threads

In unix how we can test or check race condition in any c program by using multi thread programming (5 Replies)
Discussion started by: afroze
5 Replies

6. UNIX for Dummies Questions & Answers

In unix how we can test or check race condition in a c program by using multi threads

In unix how we can test or check race condition in any c program by using multi thread programming (1 Reply)
Discussion started by: afroze
1 Replies

7. Linux

In unix how we can test or check race condition in c program by using multi threads

In unix how we can test or check race condition in any c program by using multi thread programming (1 Reply)
Discussion started by: afroze
1 Replies

8. Programming

how to check memory leak in C program under Unix

Hi, How to detect memory leak in C program under unix ? Thanks (6 Replies)
Discussion started by: useless79
6 Replies

9. UNIX for Advanced & Expert Users

Minutes a program runs.

I have a ksh script that executes a program with a predetermined timeout in minutes. If the program takes longer then the timeout then it still completes with a return code of 0. :confused: I would like to determine how long the program ran. Then if it takes longer than the timeout I would... (7 Replies)
Discussion started by: 2dumb
7 Replies

10. HP-UX

why does my program runs in conflicting mode?

my pragram runs with 3 threads, 2 work threads, one main thread. the 2 work threads run with the same mode and the same code. but now, one of the work thread can't work, and it uses the cpu more than 80%, sometimes uses 100% cpu resource. the another work thread work well. when I viewed the HP... (2 Replies)
Discussion started by: happylife365
2 Replies
Login or Register to Ask a Question