Date: Tue, 04 Dec 2001 23:19:58 -0500 From: Jim Conner <jconner@enterit.com> To: freebsd-questions@FreeBSD.ORG Subject: Re: How to make a start/stop/restart script -- Fwd: Undeliverable Mail Message-ID: <5.1.0.14.0.20011204231702.02730038@mail.enterit.com>
next in thread | raw e-mail | index | archive | help
I was out of town when I tried to send this. It bounced so I am not sure
if it went through (got well over 10,000 email messages while I was gone)
because I didn't see it come through. Anyhoo, just thought I would make
sure that it got through to the list.
- Jim
>Date: Tue, 27 Nov 2001 14:07:35 -0500
>From: "Postmaster" <postmaster@enterit.com>
>Sender: <postmaster@enterit.com>
>To: <jconner@enterit.com>
>Subject: Undeliverable Mail
>X-Mailer: <SMTP32 v991129>
>
>Delivery failed 3 attempts: freebsd-questions@FreeBSD.ORG
>
>
>Original message follows.
>
>Date: Tue, 27 Nov 2001 13:13:50 -0500
>Message-Id: <200111271313.AA4194478@enterit.com>
>Mime-Version: 1.0
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: quoted-printable
>From: "jconner" <jconner@enterit.com>
>Reply-To: <jconner@enterit.com>
>To: freebsd-questions <freebsd-questions@FreeBSD.ORG>,
> S=?ISO-8859-1?Q?=F8?=ren Neigaard <neigaard@e-box.dk>
>Subject: Re: How to make a start/stop/restart script
>X-Mailer: <IMail v6.03>
>
>
>---------- Original Message ----------------------------------
>From: S=F8ren Neigaard <neigaard@e-box.dk>
>Date: 27 Nov 2001 18:57:11 +0100
>
> >Sorry for the offtopic mail, but I know you guys know the answer :)
>
>This isn't really off-topic :)
>
> >
> >How do I make a script that can start/stop/restart a Java process?
> >Somting about probing the process string, but how do I do it!?
> >
> >It has to work on both Unix and Linux too :)
>
>I won't go into the specifics of it but it is not that difficult to do. Yo=
>ur questions more like you're interested in knowing how to kill the process=
> vs starting the process. The other thing is that you are wanting it to wo=
>rk on multiple *nix boxen which means a lil bit more work (but not much).
>
>First, you need to learn case...esac statements.
>
>case $1 in
> start) do something here;;
> stop) do something here;;
> *) default message (usually an echo to STDOUT for usage)
>esac
>
>You will also want to use the case..esac statement for the multiple OS's...=
>
>
>case $(uname -s) in
> FreeBSD) psargs=3D"u $LOGNAME";;
> SunOS) psargs=3D"-f -u $LOGNAME"
> *) exit 10;;
>esac
>
>Once that is set then in you stop) section of the first case statement you =
>can call the ps with the $psargs set in the second case statement.
>
>Here, let me wrap this up with a small example using what I have up there.
>
><code>
># Start/Stop script (simple and unfinished)
># Example by Jim Conner (MJ, TN;CHT, NC;LA, CA)
>
>funcUsage() {
> echo "ERROR: $1"
> cat << EOM
>Usage: $shProgName [start|stop|etc etc]"
>
>explanation
>
>[message truncated]
- Jim
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
http://www.perlmonks.org/index.pl?node_id=67861&lastnode_id=67861
-----BEGIN PERL GEEK CODE BLOCK----- ------BEGIN GEEK CODE BLOCK------
Version: 0.01 Version: 3.12
P++>*@$c?P6?R+++>++++@$M GIT/CM/J d++(--) s++:++ a-
>++++$O!MA->++++E!> PU-->+++BD C++++(+) UB++++$L++++$S++++$
$C-@D!>++++(-)$S++++@$X?WP+>++++MO!>+++ P++(+)>+++++ L+++(++++)>+++++$ !E*
+PP+++>++++n-CO?PO!o >++++G W++(+++) N+ o !K w--- PS---(-)@ PE
>*(!)$A-->++++@$Ee---(-)Ev++uL++>*@$uB+ Y+>+++ PGP t+(+++)>+++@ 5- X++ R@
>*@$uS+>*@$uH+uo+w-@$m! tv+ b? DI-(+++) D+++(++) G(++++)
------END PERL GEEK CODE BLOCK------ ------END GEEK CODE BLOCK------
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.0.14.0.20011204231702.02730038>
