Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 08 Jul 2007 15:57:06 -0400
From:      Dan Casey <dcasey@debtresolve.com>
To:        Lisa Casey <lisa@jellico.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Adding a new command
Message-ID:  <46914192.9030405@debtresolve.com>
In-Reply-To: <003b01c7c0b4$e01a3a50$d5b9bfcf@lisac>
References:  <003b01c7c0b4$e01a3a50$d5b9bfcf@lisac>

next in thread | previous in thread | raw e-mail | index | archive | help
Lisa
    I just went through the same migration about a month ago. Here some
things that may help.
1. As far as the location of custom scripts go.  I would make your own
location. Either /opt/companyname/bin sbin etc. or
/usr/local/companyname/bin sbin and etc.
This type of setup makes it very easier to tar a single directory and
move it to another server.

2.Edit the /etc/bash_profile, /etc/profile, /etc/csh.cshc or other
global shell config files, and make sure your custom binary directories
are in everyones path by default.

3. Don't fight it.  Symlink /bin/bash to /usr/local/bin/bash.  There is
nothing wrong with doing this, and will save you a headache when things
start to break.

4. Fix your custom scripts.  The /bin/bash should have already been
taken care of via the symlink.  Another useful thing you may want to do
is go through all your shell scripts and fix paths.  A lot of my scripts
start with a bunch of lines that look like:
awk=`which awk`
perl=`which perl`
rather then hard coding the path.  This can be helpful, but be careful
as it allows users to hijack your scripts.. Ie: in the above scenario I
could create a script in my homedir called awk, and put my homedir in
the beginning of my path.

5. Test you scripts extensively. GNU tools are not the same as BSD's.
Many commands such as cp, rm, sed, and others can have very different
results on both systems.  Read the man pages to make sure the flags your
are passing to these commands are doing what you want them to do.

6. Get used to using unlink in place of rm.  I linux you can safely rm
-rf a symlink. In BSD depending on if you end the command with a slash,
you could wipe out the the actual contents.





Lisa Casey wrote:
> Hi,
>
> Once I get this new system going I promise I'll quit pestering you
> folks :-)
>
> Got another question. This should be simple to answer. I've done this
> before but can't seem to replicate it this morning. I have a few
> scripts my employees use to do things such as add a new radius user,
> restart the radius server and tail the radius log file. The most
> simple one is radlog.  The file radlog contains the line:
> tail -f  /var/log/radius.log
>
> I need to be able to type radlog from anywhere on the system and have
> it work.
>
> I put the file radlog in /bin   (/bin and  /sbin are all in my shell's
> path). Ownership is root/wheel  permissions are 555 (I've tried 700
> and 777 - these don't need write access though). But when I type
> radlog I get command not found. I can type ./bin/radlog and it works
> but I don't want that. I thought if the file was in my path and if it
> was executable just typing the name of the file from anywhere would
> work but evidently I'm overlooking something. What?
>
> Thanks,
>
> Lisa Casey
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46914192.9030405>