![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| auto change filemanager folder colors dependent on location in directory hierarchy | bz43 | UNIX for Dummies Questions & Answers | 0 | 06-09-2009 12:07 PM |
| iPhoto: How to move the iPhoto Library Folder to a new location | iBot | OS X Support RSS | 0 | 10-17-2008 12:50 AM |
| Mac OS X 10.5: Administrator user changes to standard | iBot | OS X Support RSS | 0 | 09-27-2008 08:12 AM |
| script for Finding files in a folder and copying to another folder | satish2712 | Shell Programming and Scripting | 5 | 09-11-2008 05:07 PM |
| How to disable cd to other folder for a user | Dilippatel | AIX | 1 | 12-02-2003 07:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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. |
|
||||
|
Well the first thing you should do is move the scripts out of /tmp before someone asks "Hmm.. I wonder what that skulker script does?"!
Move them to your home directory somewhere, test them, fix them, whatever, make sure they still work, then put them to /usr/bin or /usr/local/bin or somewhere and change permissions to 555. Not clear if noone is maintaing the server, I presume you all have root access? Last edited by scottn; 4 Weeks Ago at 03:26 PM.. |
|
||||
|
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 |
|
||||
|
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.
|
![]() |
| Bookmarks |
| Tags |
| standards |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|