We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Question for Admins

akohan asked
Medium Priority
Last Modified: 2013-12-16


I have written a backup/recovery script which uses rsync. However, it requires to have a config file. the config file will be created automatically when user run it for the first time. Now my question is where should the script place it? next to itself in this same directory or in a different directory?

What is right policy for this?

Watch Question

Kerem ERSOYPresident


There's no policy with that. Generally Scripts either include some other script or just run and create a file. I generally create the file in /tmp only when it is complete I tranfer it where it will stay. Then I delete these files since /tmp is just a common place...



thanks but this is not assumed as a temp file to be placed under /tmp. From the time of config creating on it will be used. it contains sensitive informatoin that all script operations are based on it so I don't think tmp is a good place for it.
Kerem ERSOYPresident

ok just create a folder called tempscr "chmod 600" it and keep your file there when you are done transfer it to another safe place whre tyour script will be.

BTW nobody will use a plain text file to keep very sensitive info (unless he/she is younger than 12 and very naive).. These are readable to any person shuould he has some way to open it.
Actually, there *is* a policy for scripts.

They generally get placed in /usr/local/bin or .../sbin, and their config scripts can be placed either in /etc or, if you prefer, in /usr/local/include (depending on how important you think the scripts are).  It's also possible to put them in the system path -- /bin or /sbin directly -- if you think they're important enough for it.  That, though, is generally against policy, since those trees are typically reserved for root-system binaries only.

Sometimes folks place 'em in /usr/share, as well, but again that's not really policy;  the /usr/share tree is for widely available files that are available to general users, and the /usr/local tree is for files that are available for users but peculiar to the local machine (and meant to stay that way).   Since there really isn't any other place to put local files, though, it also gets used to store tailored scripts of every sort.

My backup scripts are in /usr/local/bin, for example, and their config scripts are in /etc both for convenience as well as by virtue of their importance.

If you're working on a production machine then it really wouldn't be good form to put 'em just anywhere, since that complicates the next sysadmin's life considerably.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts



Thank you. It totally makes sense.



Hello again,

Still one question I need to ask you. In my script I'm using  "rsync" and other common commands such as  cat, logger, crontab, service, gawk and ...

Now, since every machine might have placed these files under different directories so I'm going to run a find command (one-time) at the beginning of the script to find them and save them in the cofig file (let's call it initializatoin) . Then the config file will be like:

#config file
and ...

As I said the reason I'm doing this is because I noticed there are other machines that their filesystem structure in terms of location of these files is different. On Machine A  RSYNC in under /usr/bin  but on Machine B, RSYNC is located under /bin  and this script will be running on different machine.

Am I on a right track or no? please explain if you have a better suggestions



That looks pretty similar to the ones i've got on my machines, so yeah -- i think that's the right track.

I never have had to run a config-script like you do, but i've still got the commands declared at the beginning of the script because i use it over ssh; consequently, the root path gets stripped and all of the commands must be declared with the full path, every time.

Running a find command that configures the full path for each system is the answer i'd use, as well.



But sometimes find command brings up more than one path. Then what?
If all the paths are valid, then just pick one.

A simple "read" function will take the first entry and drop the rest.



I don't agree with you in this one :)

since I did so it returned two files with the same name but different sizes! way different applications.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.