Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-17-2008, 02:30 AM   #1
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:
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, 03:24 AM   #2
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.

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

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

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


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 03:43 AM
How to write script with check running program VooZ2_uk Programming 3 12-13-2006 10:57 AM
Check if program is running Conjurer Programming 8 11-17-2005 02:37 PM
find a simple Windows program to check my hardware is compatibale with Linux or no czy11421 Linux - Newbie 3 05-07-2004 07:00 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:55 PM.

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