[CentOS] good shell script examples?

2010-11-15 Thread Kill Script
I am looking for a beginner guide to shell scripting simple tasks on CentOS
(e.g. ssh'ing into a server / router / switch, checking for certain things,
then exiting and going to the next IP).

Does anyone have any suggestions on where to look?  (I'm relatively new to
bash)
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] good shell script examples?

2010-11-15 Thread Kill Script
I wrote a simple one a few years back:
> http://www.happyhacker.org/gtmhh/basha.shtml

This is great!  Thanks for sharing.
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] good shell script examples?

2010-11-16 Thread Kill Script
Gabriel Tabares wrote:
> If you don't want to use ssh keys, you will have to write scripts that
> interact with prompts, so you'll probably be looking at Expect, Python
> (pexpect or paramiko) or Perl.

In one case, this is what I have to do for some networking hardware.  I 
have to ssh in, run a command, and then analyze the output.  I'm not 
quite sure how to do this given Perl / Python / Expect / etc and am 
hoping to find some good examples online that can help me get started.
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


[CentOS] best way to start and shutdown programs in CentOS?

2010-11-21 Thread Kill Script
I have a Java program that I want to start up with every boot, but I'm
unsure how to do it.

There are two bootup scripts that start manually (script1.sh and
script2.sh), and when the server gets shutdown, we have another script that
we run (shutdownscript.sh) so that the DB does not get corrupted.
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] best way to start and shutdown programs in CentOS?

2010-11-21 Thread Kill Script
On Sun, Nov 21, 2010 at 8:18 PM, John R Pierce  wrote:

> you would create a script in /etc/rc.d/init.d/   called yourjavathing,
> which takes the parameter {start|stop} and optionally
> {reload|restart|status} ...  this script would include the header lines for
> chkconfig.   its run by init as the root user (but without any user login
> profiles).   If you want your javathing to run as a different user, you
> should invoke your script1.sh and script2.sh via su someuser -c
> "/path/to/script1.sh" ...
>

Thank you! This was very helpful.


>
> once this script exists, and you test it by invoking it as
> "/etc/rc.d/init.d/yourjavathing start" (and "... stop", etc), then
>
> chkconfig --on yourjavathing
>
> will configure the OS to run it automatically at the runlevels that your
> chkconfig header lines specify.  and,
>
>service yourjavathing start
>
> (or stop, etc) will manually start and stop the service.
>

Googling, I found this example:

http://www.linuxjournal.com/article/4445

and I think that I can easily modify this Oracle init.d example

http://www.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/044/4445/4445l1.html
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] best way to start and shutdown programs in CentOS?

2010-11-22 Thread Kill Script
On Mon, Nov 22, 2010 at 9:36 AM, Brian Mathis wrote:

> It may be tempting to use the rc.local, but that's the quick and dirty
> way and not good for the long-term sustainability and management of a
> system.  There's no way to individually control any service running
> from there, and no way to stop it on shutdown.
>

Yeah, thank you.  I talked with the person who wrote the Java program, and
he essentially said the same thing.

I'm looking through his suggestions now, and he suggested a shutdown script.
I others who have examples with pid.txt and "dirname $0".  Not sure what
these are and am googling them now.
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] best way to start and shutdown programs in CentOS?

2010-11-22 Thread Kill Script
2010/11/22 Jorge Fábregas 

> I totally agree.  My suggestion was based on the assumption that the OP
> didn't
> have much system-administration experience and using rc.local was
> definitely
> the easiest way out.
>

Exactly...

The OP was recommended that by someone else but thought better than to put
that in production!
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] best way to start and shutdown programs in CentOS?

2010-11-22 Thread Kill Script
On Mon, Nov 22, 2010 at 8:03 PM, John R Pierce  wrote:

>su-$ORA_OWNER -c $ORA_HOME/bin/dbstart
>
> should be
>
>su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
>

So, for a Java program, would you suggest creating a different user, giving
that user just enough privileges, and then running the script so that it
exited if the wrong user tried to use it?

(Just trying to think what's the best long term solution for something like
this)
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos