LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 02-17-2008, 01:30 AM   #1
KrzysieQ
LQ Newbie
 
Registered: Aug 2007
Posts: 12

Rep: Reputation: 0
Question Simple script - check if program is running


Hi, I have small problem, I have a server with ssh access (RSA keys authentication - so without password). I need a check on small period of time, if a specific program is running - if not - run it in screen.

It may be a simple bash script which I could put in my crontab.

Anybody can help me ?
I read a topic:
http://www.linuxquestions.org/questi...unning-383958/
but I don't have an idea, how to use it with ssh, because I can't run it on that server.

Sorry for my poor English.
 
Old 02-17-2008, 02:24 AM   #2
budword
Member
 
Registered: Apr 2003
Location: Wisconsin
Distribution: Switched to regualr Ubuntu, because I don't like KDE4, at all. Looks like vista on crack.....
Posts: 675

Rep: Reputation: 31
You could gin up a quick script to run "ps -A" then grep <STDOUT> for the name of the program you are looking for.

David
 
Old 02-17-2008, 02:36 AM   #3
KrzysieQ
LQ Newbie
 
Registered: Aug 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Any example ?
I would be glad
 
Old 02-17-2008, 07:48 AM   #4
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 16
Code:
! pgrep someprogram &>/dev/null && screen -s /path/to/someprogram
 
  


Reply

Tags
check, script, ssh


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
QUAINT !!! is this a gcc bug ? pls check out this simple C program.() cryincold Programming 9 02-09-2008 02:43 AM
How to write script with check running program VooZ2_uk Programming 3 12-13-2006 09:57 AM
Check if program is running Conjurer Programming 8 11-17-2005 01:37 PM
find a simple Windows program to check my hardware is compatibale with Linux or no czy11421 Linux - Newbie 3 05-07-2004 06:00 AM


All times are GMT -5. The time now is 07:46 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration