RE: Curious question

From: James Zuelow <James_Zuelow@ci.juneau.ak.us>
Date: Wed Sep 06 2006 - 08:39:26 AKDT

Tony wrote:
> Hi Adam and everyone:
>=20
> Explanation of coding
>=20
> An example of linux coding would be the directory
> where apache works off. In Red Hat, it is located at
> /var/www/html while in SuSE 10.1 it is at
> /srv/www/htdocs.
>=20

OK. Most of the time in a Linux context "coding" usually refers to
something like "putting together a lot of lines in C" (with an implied
"and then compiling them" -- "scripting" is NOT "coding" to a lot of
people, even though they are kind of the same thing). In that case,
"coding" should work the same regardless of distribution, all else being
equal. If you compare an old RedHat 5.2 install with a new Fedora Core
install you might find differences in the C libraries and compilers that
would affect your code, but it should compile just fine on Fedora Core
and Debian of the same vintage. That's why everyone was confused when
you said coding was different.

> So if I wrote a script for Red Hat and wanted to use
> it in SuSE, I have to change all the directories.
>=20

In a Linux context you are referring to the File System Hierarchy
(http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/index.html),
which can change from distribution to distribution. This is easy to
deal with though. =20

Debian typically puts html content for Apache in /var/www. A Debian
admin can `mkdir /srv`, populate it with content, and then point
httpd.conf to /srv/www instead of /var/www and everything will work just
fine. This _might_ be easier than editing all your scripts. Remember
that all these daemons use standard text config files -- there is no
"Debian Apache that can't use /srv/www."

Speaking of editing scripts, you ARE using variables for your directory
names, right?

Lets say we have an automated process to dump html files into a
directory, and we want to make sure that the Apache user has rights to
read them and that they don't have strange file permissions. Instead of
doing this:

  cd /var/www/html/internal/special
  chmod 444 *.html
  chown www-data:www-data *.html

Do this:
  html_root=3D"/var/www/"
  httpd_user=3D"www-data"
  httpd_group=3D"www-data"
  cd ${spec_dir}internal/special
  chmod 444 *.html
  chown ${http_user}:${http_group} *.html

So now if you do need to move a script from Debian to RedHat, you just
change the variables instead of editing line-by-line. It looks funny
for a short script like my example, but once you start getting into
longer, more complex stuff (network backups using afio, cgi scripts,
etc) using variables for file paths and stuff really pays off.

> There may be other small differences as well, but as I
> am learning more about the various OSes, I am getting
> used to the variations in code.
>=20
> Lately people have been recommending Ubuntu. And I may
> gravitate there as long as it runs Apache, php and
> MySQL well. The thing is so does Red Hat and SuSE so
> why even move? I got everything stabilized now and it
> could mean a lot of work to rewrite all the codes for
> a new OS which is supposed to give me benefits but all
> I want is for the software to work. It's like
> upgrading from Windows 2000 to Windows XP
> Professional. I am perfectly content with WIndows
> 2000, so for a very long time, and e.g 4 years, I
> simply did not move. So why switch OSes?
>=20
> Tony
>=20

If you put it that way, there is absolutely no reason to move at all.

None.

James Zuelow....................CBJ MIS (907)586-0236
Network Specialist...Registered Linux User No. 186591
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Wed Sep 6 08:39:43 2006

This archive was generated by hypermail 2.1.8 : Wed Sep 06 2006 - 08:39:43 AKDT