[mail_lists] My first shell script
Jim
jconner at enterit.com
Sun Apr 20 15:17:57 PDT 2003
On Friday 18 April 2003 11:31, Gerard Samuel wrote:
I would make it more manageable by changing some of the directories you have
in there to variables so that it could be edited more quickly. See below for
example:
#!/bin/sh
#
# To populate dev team mailinglist archive
#
date=`date '+%Y-%m'`
mhonarc_bin="/usr/local/bin/mhonarc"
chown_bin="/usr/bin/chown"
ecartis_base="/usr/local/ecartis"
list_archive="/files/www/data/list_archive/$date"
mbox="$ecartis_base/lists/dev-team/archives/mbox/dev-team.$date"
chown_args="-R www.www $list_archives"
mhonarc_args="-outdir $list_archives -add $mbox"
if [ ! -d $list_archive ]
then
if [ -s $mbox ]
then
mkdir $list_archives
fi
fi
$mhonarc_bin $mhonarc_args
$chown_bin $chown_args
exit 0
| Well I had just installed mhonarc to turn a mailling list archive into
| html, and didn't know how to make the
| process automagic.
| I never wrote a shell script from scratch before, and came up with this
| after a brief search on Google for commands.
| It does work, but Im just looking for critical comments to the script,
| to see if I can improve on it..
| If not, its in the archive for others to use it.
| Thanks
| ------------------------------------
| #!/bin/sh
| #
| # To populate dev team mailinglist archive
| #
|
| date=`date '+%Y-%m'`
|
| if test ! -d /files/www/data/list_archive/$date
| then
| if test -s
| /usr/local/ecartis/lists/dev-team/archives/mbox/dev-team.$date
| then
| mkdir /files/www/data/list_archive/$date
| /usr/local/bin/mhonarc -outdir
| /files/www/data/list_archive/$date
| /usr/local/ecartis/lists/dev-team/archives/mbox/dev-team.$date
| chown -R www:www /files/www/data/list_archive/$date
| fi
| exit
| else
| /usr/local/bin/mhonarc -outdir /files/www/data/list_archive/$date
| -add /usr/local/ecartis/lists/dev-team/archives/mbox/dev-team.$date
| chown -R www:www /files/www/data/list_archive/$date
| fi
| exit 0
|
| _______________________________________________
| freebsd-questions at freebsd.org mailing list
| http://lists.freebsd.org/mailman/listinfo/freebsd-questions
| To unsubscribe, send any mail to
| "freebsd-questions-unsubscribe at freebsd.org"
--
- Jim
More information about the freebsd-questions
mailing list