User script folder standard location ?

Thread Tools Search this Thread
Operating Systems AIX User script folder standard location ?
# 1  
Old 10-25-2009
User script folder standard location ?

I am starting to accumulate a few scripts that I working on to replace operational scripts and to have a few for my personal usage. I am not an admin, just an operator.

They are currently located inside the /tmp folder. I know they should not be there but since we have no system admin (someone was named for it but has no experience and almost no knowledge at all) and that the system is somewhat left on its own (no one is maintaining it except for system/database upgrades done by an external company), we were never told what the standards are.

The operational scripts we are using have been created like 10+ years ago by someone who has no script/standards knowledge (still doesn't) and hasn't put any validations, protections, support coding, ... at all. They haven't been updated since and are prone to a lot of problems due to operator mistakes. I want to gradually change this, improve and secure them. I am learning scripts to do this (which has been accepted as a project).

To move my scripts into a more secured location, I want to know what are the usual standards related to where user scripts should be located.
# 2  
Old 10-25-2009

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.

# 3  
Old 10-26-2009

in my company, scripts for maintenance, monitoring, reporting and similar are in /opt/scripts and logging into /var/tmp/output. The scripts themselves are linked into /usr/local/bin only if we want them to be user-executable (i.e. all non-intrusive scripts) and have a server-specific response file, that exports variables, IPs, and whatever might be required, that is called by the scripts and maintained with every major system change in /opt/scripts/local. Works perfectly fine for us.

Kind regards
# 4  
Old 10-26-2009
Another good habit at this point is to put your scripts in a revision control system, such as "Subversion". This protects you from the case when you (or someone else) modifies a script then can't work out what they've changed or how to get back to the working version.
# 5  
Old 10-29-2009
I have been using /admin for a while now, but since AIX6 uses an /admin filesystem I'm considering moving to /opt/local/...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

7. 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

8. 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

9. 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:// , can I make those folders appear green? And when I open another instance of... (0 Replies)
Discussion started by: bz43
0 Replies
Login or Register to Ask a Question