* Is a process running ?
@ 2003-07-28 9:20 Tim Fletcher
2003-07-28 13:14 ` John T. Williams
0 siblings, 1 reply; 4+ messages in thread
From: Tim Fletcher @ 2003-07-28 9:20 UTC (permalink / raw)
To: Linux-Newbie@Vger. Kernel. Org
Hi all,
i would like to write a simple shell script that checks for the existence of a certain programme, in this case python2.1. if the
programme is active, do nothing, if not, start it.
i did think of doing a ps -A |grep python2.1, but then i have no idea how to intergrate that in the shell script.
any ideas would be very welcome
Thanks & HAND
Tim
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Is a process running ?
2003-07-28 13:14 ` John T. Williams
@ 2003-07-28 11:02 ` Tim Fletcher
2003-07-28 16:32 ` Kees Cook
1 sibling, 0 replies; 4+ messages in thread
From: Tim Fletcher @ 2003-07-28 11:02 UTC (permalink / raw)
To: John T. Williams, Linux-Newbie@Vger. Kernel. Org
Thanks very much, works great :)
Tim
> -----Message d'origine-----
> De : John T. Williams [mailto:jtwilliams@vt.edu]
> Envoyé : lundi 28 juillet 2003 15:14
> À : tfletcher@netfactoriel.com; Linux-Newbie@Vger. Kernel. Org
> Objet : Re: Is a process running ?
>
>
> Something like this would do it
>
> ------------------- pythstart.sh ----------------------
> #!/bin/bash
>
> ps -A | grep -e "[ /]python2.1\>" 1> /dev/null 2> /dev/null
>
> if[ $? != 0]; then
> python2.1
> fi
>
> -----------------end pythstart.sh-----------------------
>
>
>
>
>
> ----- Original Message -----
> From: "Tim Fletcher" <tfletcher@netfactoriel.com>
> To: "Linux-Newbie@Vger. Kernel. Org" <linux-newbie@vger.kernel.org>
> Sent: Monday, July 28, 2003 2:20 AM
> Subject: Is a process running ?
>
>
> >
> > Hi all,
> >
> > i would like to write a simple shell script that checks for the existence
> of a certain programme, in this case python2.1. if the
> > programme is active, do nothing, if not, start it.
> >
> > i did think of doing a ps -A |grep python2.1, but then i have no idea how
> to intergrate that in the shell script.
> >
> > any ideas would be very welcome
> >
> > Thanks & HAND
> > Tim
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.linux-learn.org/faqs
>
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is a process running ?
2003-07-28 9:20 Is a process running ? Tim Fletcher
@ 2003-07-28 13:14 ` John T. Williams
2003-07-28 11:02 ` Tim Fletcher
2003-07-28 16:32 ` Kees Cook
0 siblings, 2 replies; 4+ messages in thread
From: John T. Williams @ 2003-07-28 13:14 UTC (permalink / raw)
To: tfletcher, Linux-Newbie@Vger. Kernel. Org
Something like this would do it
------------------- pythstart.sh ----------------------
#!/bin/bash
ps -A | grep -e "[ /]python2.1\>" 1> /dev/null 2> /dev/null
if[ $? != 0]; then
python2.1
fi
-----------------end pythstart.sh-----------------------
----- Original Message -----
From: "Tim Fletcher" <tfletcher@netfactoriel.com>
To: "Linux-Newbie@Vger. Kernel. Org" <linux-newbie@vger.kernel.org>
Sent: Monday, July 28, 2003 2:20 AM
Subject: Is a process running ?
>
> Hi all,
>
> i would like to write a simple shell script that checks for the existence
of a certain programme, in this case python2.1. if the
> programme is active, do nothing, if not, start it.
>
> i did think of doing a ps -A |grep python2.1, but then i have no idea how
to intergrate that in the shell script.
>
> any ideas would be very welcome
>
> Thanks & HAND
> Tim
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is a process running ?
2003-07-28 13:14 ` John T. Williams
2003-07-28 11:02 ` Tim Fletcher
@ 2003-07-28 16:32 ` Kees Cook
1 sibling, 0 replies; 4+ messages in thread
From: Kees Cook @ 2003-07-28 16:32 UTC (permalink / raw)
To: linux-newbie
John T. Williams wrote:
> ps -A | grep -e "[ /]python2.1\>" 1> /dev/null 2> /dev/null
A quick short-cut for the last part:
ps -A | grep -e "[ /]python2.1\>" >/dev/null 2>&1
"1" (stdout) is used by default, and then 2>&1 takes "2" (stderr) and
sends (>) it to the same location (&) as "1".
--
Kees
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-07-28 16:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-28 9:20 Is a process running ? Tim Fletcher
2003-07-28 13:14 ` John T. Williams
2003-07-28 11:02 ` Tim Fletcher
2003-07-28 16:32 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox