![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| waiting until file loaded | mogabr | Shell Programming and Scripting | 1 | 08-08-2008 11:24 AM |
| Help shell script to loop through files update ctl file to be sql loaded | dba_nh | Shell Programming and Scripting | 1 | 04-15-2008 09:00 PM |
| How can I make the for command check to see if a file is empty before executing? | chrchcol | Shell Programming and Scripting | 3 | 07-29-2006 04:14 AM |
| executing *.bat file on windows from Unix box via ftp command | alx | Shell Programming and Scripting | 9 | 01-29-2006 06:31 PM |
| executing dir or ls command via FTP | alx | Shell Programming and Scripting | 5 | 01-27-2006 06:13 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help executing command loaded from file
I need to execute a command that is loaded from a file.
Basically, we have several scripts that need to be run at scheduled times. We're going to store those times in the database and update a file with data. In that file we'll have scriptName, inputParameters, runTimes, etc... I chose to use tilda (~) as the delimiter as it can't be used by any of the input variables ![]() I got it all working, with one exception. If an inputParameter needs to be executed (current date `date +'%d%m'`) Then I get this error: Code:
./chk_master_script.sh[247]: `date +%m%d`: not found Launching script (with parameters): $HOME/daily/scripts/workit.sh Code:
if [ -s ${masterDataFile} ]; then
fileExists=true
IFS="~"
while read workerScript parameters timingStuff; do
...
params=`${parameters}`
echo "Launching script (with parameters): ${workerScript} ${params}"
...
done
Code:
filename~parameters~schedulingStuffHere Code:
workerScript.sh~`date '+%m%d'`~stuffGoesHere ![]() |
|
||||
|
Thanks a lot cfajohnson,
you rule ![]() But now I have another question ![]() I've got my attributes evaluated, however I need to consider if multiple attributes are passed through, as a single string ![]() Basically, I need to tokenize the parameters string This is what I have so far: Code:
...
evalParams()
{
output=""
input="$1"
set -A attr $(echo ${input} | tr ',' ' ' )
n="0"
while [ "${n}" -lt "${#attr[*]}" ];
do
eval "p=${attr[${n}]}"
output="${output} ${p}"
n=`expr $n + 1`
done
echo ${output}
}
...
## this is actually loaded from file, but for the purpose of an example it's fine :)
parameters="`date +%m%d`,`date +%H%M`"
...
params=`evalParams ${parameters}`
![]() The attr array isn't being populated as I expected, the entrie parameter string just gets assigned to the 1st index (index 0) As for cronjobs, we're trying to get our scheduling in the DB. - We want our schedules to be centralized - Makes learning the timings of the batch easier Last edited by GoldenEye4ever; 03-18-2009 at 12:50 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|