Execute a Command in a .Dat File and use it in other Files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execute a Command in a .Dat File and use it in other Files
# 1  
Old 04-06-2018
Execute a Command in a .Dat File and use it in other Files

We have a process where we store the database password in a config file like below from where the password is picked up and used in Database Scripts

ID, Password

But we now have a Audit Requirement not to have the passwords in Config Files directly. We have a command which could fetch the password from external link

So wanted to check if we could have that executable command in the config file

Something like :
ID, `Executable Command`

So that when the above file is being used in database script it resolves the password
# 2  
Old 04-06-2018
Maybe.
Depends upon how the config file is made available to the script.
If the config file is a list of ordered pairs:
Code:
user<separator>username
base_directory<separator>/home
etc

then the answer is no, if however the config file looks like:
Code:
user=username; export user
password=abcdef; export password

and the config file is included in the script with
Code:
. config_file

then changing the password line to:
Code:
password=$(getpasswd); export password

should work.
# 3  
Old 04-06-2018
You can't generally put commands in config files, that's why they're config files and not full-blown scripts. You may actually have to modify your scripts.

This is often done with wrappers to make it less difficult. Instead of mydbms you run some other command which runs mydbms with the same arguments / environment plus a password. This file would be protected by access permissions to prevent it being publicly readable, so you'd have to use sudo to run it, and make sure only the relevant user can sudo for only that file, etc.

Exact details depend on what exactly you're doing.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sed command to replace "|" with ^ for all *.dat files in a folder not working

I am trying to use the below sed command to replace all "|" to ^, in a folder had 50 dat files. when i tried with 1 file it worked but when i tried with wild card, is not working. sed -i 's/"|"/\^/g' *.dat Is this the proper way to use sed command thank you very much for help. (3 Replies)
Discussion started by: cplusplus1
3 Replies

2. Shell Programming and Scripting

How to use 'ls' command to list files like *.dat, not *.*.dat?

How to use 'ls' command to list files like *.dat, not *.*.dat (5 Replies)
Discussion started by: pmcginni777
5 Replies

3. Shell Programming and Scripting

Help with Getting distinct record count from a .dat file using UNIX command

Hi, I have a .dat file with contents like the below: Input file ============SEQ NO-1: COLUMN1========== 9835619 7152815 ============SEQ NO-2: COLUMN2 ========== 7615348 7015548 9373086 ============SEQ NO-3: COLUMN3=========== 9373086 Expected Output: (I just... (1 Reply)
Discussion started by: MS06
1 Replies

4. Shell Programming and Scripting

awk command on .DAT file not working?

Hi All, I am trying to run awk command on .DAT file and it is not working. The same command is working on .txt file: Contents of the file ZZ_55555555_444444_ZZZZZZ_7777777_888_99.DAT: HEADER|ZZ_55555555_444444_ZZZZZZ_7777777_888_99.DAT... (10 Replies)
Discussion started by: sagar.cumar
10 Replies

5. Shell Programming and Scripting

find specific file names and execute a command depending on file's name

Hi, As a newbie, I'm desperate ro make my shell script work. I'd like a script which checks all the files in a directory, check the file name, if the file name ends with "extracted", store it in a variable, if it has a suffix of ".roi" stores in another variable. I'm going to use these two... (3 Replies)
Discussion started by: armando110
3 Replies

6. UNIX for Dummies Questions & Answers

For Loop to execute a command on a series of files

Hello, I have a set of input data that I split into batches using the following command: split -l 4000000 MyInput.in Split_a Once I get the split files, I run a certain command on the split files that spews an output. So far I have been doing it without a for loop. How can I translate the... (2 Replies)
Discussion started by: Gussifinknottle
2 Replies

7. Programming

Assign a command to execute a file

Hi all, I want to assign a command name to a file.e.g. suppose I have a .sh file "xyz.sh". I want to execute the file by typing in "abc". The desired output is: $ abc should execute the "xyz.sh" file. Kind Regards, Qasim (4 Replies)
Discussion started by: qasim
4 Replies

8. Shell Programming and Scripting

Execute .dat file from a shell script

Hi, I have a .dat file in my home directory of UNIX. I want this file to be executed by a shell script. Please help me out a.s.a.p (2 Replies)
Discussion started by: user9526
2 Replies

9. UNIX for Dummies Questions & Answers

Using cp -r command to selectively omit *.dat files while copying a directory.

Hi all, I want to copy a directory named Ec1 to another directory named Ec2, newly created. But Ec1 has a bunch of *.dat files and many many other kinds of files. Whle creating Ec2, I selectively want to omit the *.dat files since they are huge files of the order of 100 MBs and there are... (5 Replies)
Discussion started by: d_sai_kumar
5 Replies

10. Shell Programming and Scripting

compare two .dat files and if there is any difference pulled into a separate file

Hi, compare two .dat files and difference will be moved into separate file.if anybody having code for this please send asap. using diff command, i don't know how to write shell programming. and my first file is like this including Header and trailer 10Ç20060323Ç01(Header) 01ÇIÇbabuÇ3000 01ÇIÇbaluÇ4000... (1 Reply)
Discussion started by: kirankumar
1 Replies
Login or Register to Ask a Question