Re: Adding a new command

2007-07-08 Thread Ian Smith
On Sat, 7 Jul 2007 16:20:53 -0500 Jeffrey Goldberg wrote:
  On Jul 7, 2007, at 11:42 AM, Peter Boosten wrote:
  
   It's more obvious to put local scripts in /usr/local/bin, IMHO.
  
  Let me add to this (as someone who recently moved from linux to  
  FreeBSD).  Unlike Linux, FreeBSD isn't just a kernel, but a complete  
  operating system.  So the things in /bin and /usr/bin are as fully  
  part of FreeBSD as the kernel itself, while on Linux distributions,  
  those things are bundled with Linux as part of a distribution.
  
  So this is one reason why it is best to put tools like you describe in
  
 /usr/local/sbin

My preference for such local scripts that ought not be confused with any
system (or local port) scripts is to put them in /root/bin .. no chance
of any sort of upgrade clobbering them there, and your own scripts are
all together.  You need to specify full path for any of these where used
in a crontab, but that's good practice anyway.

If you're using [t]csh, as Lisa appears to be (needing to run 'rehash'
to find newly added commands), $HOME/bin is already in the default path.

Cheers, Ian

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding a new command

2007-07-08 Thread Dan Casey
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
 [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding a new command

2007-07-07 Thread Peter Boosten

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?
 

try typing 'rehash' first (without the quotes).

It's more obvious to put local scripts in /usr/local/bin, IMHO.

Hope this helps.

Peter
-- 
http://www.boosten.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding a new command

2007-07-07 Thread Derek Ragona

At 11:35 AM 7/7/2007, 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


Try testing with a new login session.  It is likely your shell is caching 
the commands in your paths.


You can easily test after logging in and try the which command:
which radlog

On the permissions, you would do well to setup a special group to execute 
the commands making it easier for users to execute them without being 
root.  If your new utilities are working with log files be sure the log 
files are readable by this group as well.


As previously mentioned added user commands are customarily placed in 
/usr/local/bin doing so will aid any new sysadmin looking for them.



-Derek

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding a new command

2007-07-07 Thread Jeffrey Goldberg

On Jul 7, 2007, at 11:42 AM, Peter Boosten wrote:


It's more obvious to put local scripts in /usr/local/bin, IMHO.


Let me add to this (as someone who recently moved from linux to  
FreeBSD).  Unlike Linux, FreeBSD isn't just a kernel, but a complete  
operating system.  So the things in /bin and /usr/bin are as fully  
part of FreeBSD as the kernel itself, while on Linux distributions,  
those things are bundled with Linux as part of a distribution.


So this is one reason why it is best to put tools like you describe in

  /usr/local/sbin

Cheers,

-j


--
Jeffrey Goldberghttp://www.goldmark.org/jeff/

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding a new command

2007-07-07 Thread Garrett Cooper

Derek Ragona wrote:

At 11:35 AM 7/7/2007, 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


Try testing with a new login session.  It is likely your shell is 
caching the commands in your paths.

Use rehash in tcsh to find newly added commands.

export or setenv your new PATH though, and try the new command out first.

-Garrett
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]