Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-08-2005, 11:17 AM   #1
LQ Newbie
Registered: Sep 2003
Posts: 26

Rep: Reputation: 15
Bash Scripting Question


I want to write a simple script that checks to see if aMule is running, and if it is not running - activate the program.

My main directions are using grep somehow, though simply typing "ps ax | grep amule" always gives some answer (even if amule is not running).

I'd appreciate any help.

Old 11-08-2005, 11:44 AM   #2
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 30
What answer does it give you if it's not running?
Old 11-08-2005, 11:46 AM   #3
Senior Member
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 55
[ `pidof -s amule` == "" ] && amule

When making
 ps ax | grep pattern
, you always get the line "grep pattern" because "grep pattern" contains "pattern", so
 ps ax | grep amule | grep -v grep
could do the trick
Old 11-15-2005, 03:53 AM   #4
LQ Newbie
Registered: Sep 2003
Posts: 26

Original Poster
Rep: Reputation: 15
Thank You
Old 11-19-2005, 05:09 AM   #5
Senior Member
Registered: Jun 2004
Location: Spain
Distribution: FC5
Posts: 1,993
Blog Entries: 1

Rep: Reputation: 46
would you mind posting your resulting script? I'd like to have a look at it and see if I can adapt it in some way to check the kppp demon is running. It's crashing on me every 1 or 2 days and it would be nice to be able to keep a tab on it, close all kppp related threads , restart and reconnect automatically (as opposed to finding out kppp crashed 5 minutes after I went to bed while trying to do a 'yum update')


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
bash scripting question bmfan Linux - Software 6 11-04-2005 08:54 PM
Bash scripting question. pete1234 Programming 23 09-22-2005 06:52 PM
Bash Scripting Question jsimmonds Programming 2 06-16-2005 09:07 AM
BASH Scripting question flagg0204 Programming 4 12-23-2004 07:59 AM
Bash scripting question Hammett Linux - General 4 11-29-2004 06:29 AM

All times are GMT -5. The time now is 09:43 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