Sponsored Content
Operating Systems AIX User script folder standard location ? Post 302365059 by bakunin on Sunday 25th of October 2009 03:55:16 PM
Old 10-25-2009
Wrench

Sorry, scottn, i would never put a script (or anything else i wrote) to /usr/bin.

/usr/bin is the place for the system binaries and provided by the OS vendor. If you put anything there you run a (small but existing) chance that one of the following updates puts an OS binary there with the same name as your utility, overwriting your script. Better leave the systems directory untouched.

/usr/local/bin is a different case because it is the place to put local extensions to the OS. This is a good place to put your utility.

I think an even better way is to create a script-set with all of your scripts (ideally to be installed via installp) and have a separate directory where you install all your scripts. For instance a directory /usr/local/bin/<something>, where you put all your scripts. If you create new scripts or change existing ones you can simply repackage them to another version of your script-set and update the system with it.

Another recommended technique: You probably have a lot of common tasks to do in your scripts to make them as robust as possible: You probably write some kind of log as the script executes so that if the script crashes you could find out why and where. You probably write some temporary files so you might want to check before if there is enough space left on the filesystem to do so and you might want to clean your temp files afterwards. You probably want to set a common environment at the scripts start to avoid the "cron problem number one": a script works perfectly from commandline but fails when called from cron because it uses the login shells environment implicitly.

Write functions for these common tasks and put them in separate files. Korn shells allows to use external functions and to search for them via the FPATH-variable, a device similar to the PATH-variable for executables. I have all my (~50) functions in a directory /usr/local/lob/ksh and set the FPATH variable to this directory. This way i make sure all the functions are found.

My own script package creates/updates the following directories:

/usr/local/etc - configuration files for some scripts
/usr/local/log - log files my scrpts write
/usr/local/lib/ksh - ksh functions i rely on
/usr/local/bin/ksh - scripts themselves

I hope this helps.

bakunin
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

auto change filemanager folder colors dependent on location in directory hierarchy

Hello, Is it possible to make a file manager use different "colored folders" when browsing specific directories? For example, if I open a gnome file manager and browse my windows share at, smb://192.168.1.101/z/ , can I make those folders appear green? And when I open another instance of... (0 Replies)
Discussion started by: bz43
0 Replies

2. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

3. Shell Programming and Scripting

Unix Shell scripting -How to skip User Standard input section from another script

All, problem Description: For example: I have two shell scripts(executables). let name it as script1 and script2.I'm trying to execute script1 from script2. while executing script2, script1 is asking for manual input(input from keyboard). Now i need to know how I can skip this user input... (3 Replies)
Discussion started by: techie99
3 Replies

4. UNIX for Dummies Questions & Answers

Mounting a standard user, windows share at login

I know how to mount my share via /etc/fstab automatically when the system boots but since I do not have root permission to access the /etc/fstab nor do I think that the system admin wants me to add an entry in /etc/fstab all together. So what file could I add my mount entry in? mount -t cifs... (8 Replies)
Discussion started by: metallica1973
8 Replies

5. Shell Programming and Scripting

Copy files in thumbnail folder to a secondary location for Amazon S3

Hello all! I am trying to create a script that will copy files from one location, to another but only folders that are filled with thumbnails to an exact directory replica in the second location. For example: /images/2012/01/19/Event/Photographer/thumbnails to ... (4 Replies)
Discussion started by: Buzzman25
4 Replies

6. UNIX for Dummies Questions & Answers

Linux user location/directoires

Hi, I need to create a user. I know it sounds simple but I'm having a slight issue with it. For example I want to create user1 with home location of /home/projects/user1. I went ahead and created the projects directory using mkdir under /home, and using vi I created the user1 directory under... (2 Replies)
Discussion started by: abhi7514
2 Replies

7. OS X (Apple)

Folder location interrupted

Have had hidden/interrupted folder. It is on a NTFS-partition I use for OS and Bootcamp. I think that the problem is a HFS+ problem. I happened with all the folder which had a slash "/" in their folder name. So for example I had the folder "test/rand". Recently it disappeared from finder. In... (9 Replies)
Discussion started by: sceltecs
9 Replies

8. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies

9. Red Hat

Cannot set 'soft limits' for 'maximum stack size' for a standard user

Hi Guys, I'm trying to install Oracle Database on to Oracle Linux 7.6 but when the database install package checks the OS set-up, it keeps on failing on the soft limits for the stack. It's default value is 8192 but I'm trying to set it to 10240. This is what I added to... (2 Replies)
Discussion started by: ASGR
2 Replies
GIT-SH-SETUP(1) 						    Git Manual							   GIT-SH-SETUP(1)

NAME
git-sh-setup - Common git shell script setup code SYNOPSIS
. "$(git --exec-path)/git-sh-setup" DESCRIPTION
This is not a command the end user would want to run. Ever. This documentation is meant for people who are studying the Porcelain-ish scripts and/or are writing new ones. The git sh-setup scriptlet is designed to be sourced (using .) by other shell scripts to set up some variables pointing at the normal git directories and a few helper shell functions. Before sourcing it, your script should set up a few variables; USAGE (and LONG_USAGE, if any) is used to define message given by usage() shell function. SUBDIRECTORY_OK can be set if the script can run from a subdirectory of the working tree (some commands do not). The scriptlet sets GIT_DIR and GIT_OBJECT_DIRECTORY shell variables, but does not export them to the environment. FUNCTIONS
die exit after emitting the supplied error message to the standard error stream. usage die with the usage message. set_reflog_action set the message that will be recorded to describe the end-user action in the reflog, when the script updates a ref. git_editor runs an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or EDITOR) on a given file, but error out if no editor is specified and the terminal is dumb. is_bare_repository outputs true or false to the standard output stream to indicate if the repository is a bare repository (i.e. without an associated working tree). cd_to_toplevel runs chdir to the toplevel of the working tree. require_work_tree checks if the repository is a bare repository, and dies if so. Used by scripts that require working tree (e.g. checkout). get_author_ident_from_commit outputs code for use with eval to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit. AUTHOR
Written by Linus Torvalds <torvalds@osdl.org[1]> DOCUMENTATION
Documentation by Junio C Hamano and the git-list <git@vger.kernel.org[2]>. GIT
Part of the git(1) suite NOTES
1. torvalds@osdl.org mailto:torvalds@osdl.org 2. git@vger.kernel.org mailto:git@vger.kernel.org Git 1.7.1 07/05/2010 GIT-SH-SETUP(1)
All times are GMT -4. The time now is 02:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy