Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help with loading config files Post 302514592 by selvam on Sunday 17th of April 2011 01:20:53 AM
Old 04-17-2011
Data Help with loading config files

Hi All,

I'm bit confused with a script
Any help would be appreciated

I have a config file say config.cfg and iam loading config file in My_Script.sh..The script name is My_Script.sh.
My_Script.sh and config.cfg are in same directory...My_Script.sh is run on the crontab
Code:
50 01 * * * [ -f /home/k7/My_Script.sh ] && cd /data2/log/bin/oapi; ./My_Script.sh -t weekly > /dev/null 2>&1

The contents of config.cfg is
Code:
OUTPUT_FILE=/home/k7/final_output.csv

and the contents of My_Script is
Code:
#!/bin/sh
....
....
USAGE="USAGE: $0 -t weekly|monthly\n"
....
....
....
$CONFIG_FILE=./config.cfg

. $CONFIG_FILE #Loading config file

if [ $? -ne 0 ]
then
    echo "Error while loading $CONFIG_FILE config file"
    exit 1
fi

...
...
...

set -- `getopt t: $*`
if [ $? -ne 0 ]
then
    echo $USAGE
    exit 1
fi

1)In this code
Code:
if [ $? -ne 0 ]
then
    echo "Error while loading $CONFIG_FILE config file"
    exit 1
fi

what does if [ $? -ne 0 ] condition signify.I mean what is "$?" implies...


2)what the below two code implies
1st code
Code:
set -- `getopt t: $*`
if [ $? -ne 0 ]
then
    echo $USAGE
    exit 1
fi

2nd code
Code:
50 01 * * * [ -f /home/k7/My_Script.sh ] && cd /data2/log/bin/oapi; ./My_Script.sh -t weekly > /dev/null 2>&1

Thanks in advance

Last edited by Scott; 04-17-2011 at 02:51 PM.. Reason: Code tags, please...
 

9 More Discussions You Might Find Interesting

1. HP-UX

Config Files

Does anyone have a list of key config files and the respective paths for HP-UX? Or does anyone know where I can get a list similar to this? Thanks, TOdd (0 Replies)
Discussion started by: toddjameslane
0 Replies

2. Shell Programming and Scripting

Function loading in a shell scripting like class loading in java

Like class loader in java, can we make a function loader in shell script, for this can someone throw some light on how internally bash runs a shell script , what happenes in runtime ... thanks in advance.. (1 Reply)
Discussion started by: mpsc_sela
1 Replies

3. Shell Programming and Scripting

loading Binary files with SQLLDR

Hi, Can anyonr please tell how to load a binary file through SQLLDR. I have the structure of the binary file in a seperate lb file but I don't know how to feed it to the sqlldr. (0 Replies)
Discussion started by: snowline84
0 Replies

4. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. UNIX for Advanced & Expert Users

Loading files incrementaly

Hi Am trying to sftp this way UnixBoxA----->UnixBoxB My code will run on UnixBoxB, it will make a secure connection and pull the files from UnixBoxA. Apart from that I do not have any access on UnixBoxA Now UnixBoxA will receive the files daily, the file format will be... (0 Replies)
Discussion started by: hemanty4u
0 Replies

7. Shell Programming and Scripting

What's the best way to read config files?

(copied directly from my other thread about something else) At the moment, I just use... cat config_file|grep var_name|cut -d'=' -f2 ... which is fine for what I've been doing, but I'm not sure what to do when there are a variable number of entries and I want it go through them like a... (7 Replies)
Discussion started by: ninjaaron
7 Replies

8. Shell Programming and Scripting

Need some help on scripting for validating the files before loading

Hi, I need to perform some validation steps on the files before I start loading them. 1. I need to check for the availabilty of the file in expected path with expected name. 2. I need to check If the file format is correct. a. confirm if correct delimiter is used. b.... (1 Reply)
Discussion started by: smileyreddy
1 Replies

9. Windows & DOS: Issues & Discussions

(VS 2008) New build config looking files from other folder build config

Hi Team, My new build configuration always looking for the files from the build where i copied from. please help me to resolve this. I am using Visual studio 2008.It has Qt 4.8. plugins,qml,C++ development I created new debug_new build configuration with additional preprocessor from the... (1 Reply)
Discussion started by: SA_Palani
1 Replies
override_config_file(3alleg4)					  Allegro manual				     override_config_file(3alleg4)

NAME
override_config_file - Specifies a file containing config overrides. Allegro game programming library. SYNOPSIS
#include <allegro.h> void override_config_file(const char *filename); DESCRIPTION
Specifies a file containing config overrides. These settings will be used in addition to the parameters in the main config file, and where a variable is present in both files this version will take priority. This can be used by application programmers to override some of the config settings from their code, while still leaving the main config file free for the end user to customise. For example, you could spec- ify a particular sample frequency and IBK instrument file, but the user could still use an `allegro.cfg' file to specify the port settings and irq numbers. The override config file will not only take precedence when reading, but will also be used for storing values. When you are done with using the override config file, you can call override_config_file with a NULL parameter, so config data will be directly read from the current config file again. Note: The override file is completely independent from the current configuration. You can e.g. call set_config_file, and the override file will still be active. Also the flush_config_file function will only affect the current config file (which can be changed with set_con- fig_file), never the overriding one specified with this function. The modified override config is written back to disk whenever you call override_config_file. Example: override_config_file("my.cfg"); /* This will read from my.cfg, and if it doesn't find a * setting, will read from the current config file instead. */ language = get_config_string("system", "language", NULL); /* This will always write to my.cfg, no matter if the * settings is already present or not. */ set_config_string("system", "language", "RU"); /* This forces the changed setting to be written back to * disk. Else it is written back at the next call to * override_config_file, or when Allegro shuts down. */ override_config_file(NULL); Note that this function and override_config_data() are mutually exclusive, i.e. calling one will cancel the effects of the other. SEE ALSO
override_config_data(3alleg4), set_config_file(3alleg4) Allegro version 4.4.2 override_config_file(3alleg4)
All times are GMT -4. The time now is 03:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy