Link to home
Start Free TrialLog in
Avatar of akohan
akohan

asked on

Question for Admins


Hello,

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?

Thanks
Avatar of Kerem ERSOY
Kerem ERSOY

Hi,

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...
Avatar of akohan

ASKER


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.
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.
ASKER CERTIFIED SOLUTION
Avatar of kyle_in_taiwan
kyle_in_taiwan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of akohan

ASKER


Thank you. It totally makes sense.
Avatar of akohan

ASKER



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
RSYNC=/usr/bin/rsync
SERVICE=/sbin/service
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

Thanks

 


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.
Avatar of akohan

ASKER


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.
Avatar of akohan

ASKER


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.