I -did- say it was Crappy[tm] :) Actually, Chuck and I have made some
slight modifications to it today, as he keeps asking me to fix stuff :)
I'm sure he'll post or CVS that one soon, but I think we might fold in
some of your ideas first.
Anyway, responses interspersed:
On Sun, 8 Apr 2001, Dillon Jones wrote:
> Wouldn't 'AppServer stop' work for the stop) command? That's all I'm
> doing, and it appears to work.
Probably so. This didn't exist when I originally wrote the script. In
fact, it's probably safe to say that 'AppServer stop' exists because I
flamed Chuck about that, but I wouldn't swear to it.
However, saving the PID to a configurable location then reusing that PID
to kill is ultimately "cleaner" inasmuch as you can run multiple AppServer
instances. I'm not sure how exactly you'd tell AppServer which instance
you wanted to "stop". Although, I guess if you point it at the same config
file as the one you want to stop, it would know on which port to contact
> What account do you recommend for AppServer? I created a new one,
> webware, and I'm wondering if this will cause future issues -- must it
> be run as root (Hope not!); should it be run as same account as
> your webserver (in my case apache)?
This is, of course, a site-specific choice. I would say that running it as
its own user (webware), possibly even creating a separate user for each
"instance" of AppServer you intend to run (ie: 'medapp', 'billapp', etc.),
would be safest. That way, if for some reason Apache itself is
compromised, an attacker can still only get to your AppServer through the
AppServer port and the AppServer protocol.
No, definitely don't run it as root :)
> Also, the daemon function (rh-based systems) will run the init script as
> the user set eithe with '--user foo' or in variable 'daemon_user.'
> For consistency you could just set the daemon_user env variable,
> then su - $daemon_user -c "$WK_DIR/AppServer"
Yeah, I should learn more about this :) I have this pair of pants, the
seat of which figures prominently in my scripting :) Also, I usually write
my RC scripts by cutting and pasting, and sometimes I cut and paste from
an old box with old RC scripts :)
Chuck: this daemon stuff is a good idea, so you could rewrite the
AppServer startup line as Dillon suggests...
> The 2>errolog >log stuff isn't working yet--everything from the startup
> script itself is going to syslog.
Are you saying that in the examples you gave it doesn't work? Or are you
saying that my original script doesn't work? For the record, bash's
redirection operator SUCKS SOMETHING OFFENSIVE. Sorry. Anyway...
There are two issues here. The first is how to get bash redirection
"right". The second is that we shouldn't even have to deal with it.
AppServer ought to blast its logs to configurable locations (or, hey, use
syslog!), and only default to stdout and stderr when it had no other
instructions. Chuck? :)
Also, you probably ought to use the >> operator:
so that you don't clobber any interesting history from the logfiles.
And, no, I'm not really sure why the 2> and > aren't working for you. I'll
look at it when I get a chance, but like I said, we should fix logging in
AppServer instead of hacking it up in bash...
#define we Chuck
Joy-Loving * Tripp Lilley * http://stargate.eheart.sg505.net/~tlilley/
"Fiber makes you poop." -- From <http://www.pvponline.com/bts_studio.php3>