On 07/06/2011, at 5:31 PM, Rick Phillips wrote:
> I removed the /sys folder from the script that I wrote and everything
> went fine.  I have not tried your script rewrite fully yet as we had a
> number of other disasters today and time was against me but I will try
> it as soon as I can.

Cool - glad it's ticking along, but sorry to hear about the other probs.  Hope 
you get it all ironed out :)

> Actually, I really appreciated your elegant rewrite of my original and I
> have learned a lot from that.  I really must get smarter when writing
> these things.  My problem is that I will start with a couple of lines
> and then keep tweaking it and next thing I know I have a monster written
> in the form I displayed.  That means I should pre-plan what I am
> attempting to do and then write the script more elegantly.

Heheh - no problems.  I know what you mean; simple one liner turns into a 
"little" script which morphs into franken-script from hell!  I try to make sure 
all my scripts follow a predictable pattern:

1. hash-bang line (bash/perl/awk/whatever)
2. check running user if appropriate
3. define variables (if needed...usually better to use them regardless)
4. define functions (if needed)
5. Do the work :)
6. Log/notify about results (if needed)

Not all sections are needed all the time, but I normally use #1, #3 and #5 (and 
there are times I leave #1 out - if it's called by another script for example).

> Thanks again for taking the time to give me a lesson in better
> coding/scripting.

You're very welcome :)  I know the function to start/stop services and the 
supporting variable with service names was overkill, but I thought if you saw 
how functions work in bash it might be a new tool you can use.  Glad I was able 
to help out.

I know you've opted for a roll-your-own, and there's no real harm in that, but 
I agree with others here; the small time/effort investment in something like 
bacula will pay dividends.  Bacula has a great webmin module (www.webmin.com) 
which makes administration a doddle if you want to avoid config files and 
command line console.  There's also a featureful GTK administration tool called 
"BAT" (Bacula Admin Tool - http://wiki.bacula.org/doku.php?id=bat).  Lastly, as 
others have pointed out, there are a lot of performance tuning gotchas with 
roll-your-own solutions that are normally pre-configured with tools like bacula.

Take care,

James

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to