Sponsored Content
Top Forums Shell Programming and Scripting Help executing command loaded from file Post 302298469 by GoldenEye4ever on Tuesday 17th of March 2009 02:57:03 PM
Old 03-17-2009
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 Smilie

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

This is roughly how I load the data:
Code:
if [ -s ${masterDataFile} ]; then
  fileExists=true
  IFS="~"
  while read workerScript parameters timingStuff; do
    ...
    params=`${parameters}`
    echo "Launching script (with parameters): ${workerScript} ${params}"
    ...
  done

File Layout:
Code:
filename~parameters~schedulingStuffHere

Sample File Contents:
Code:
workerScript.sh~`date '+%m%d'`~stuffGoesHere

Thanks Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

executing *.bat file on windows from Unix box via ftp command

I have created get_list.bat file containing following line: dir /B /O-d >file_list.txt I am executing ftp command from Unix box and transferring get_list.bat file to windows server. In my next ftp command I am trying to execute this test.bat file by entering this line: get_list or by... (9 Replies)
Discussion started by: alx
9 Replies

2. Shell Programming and Scripting

How can I make the for command check to see if a file is empty before executing?

Here is the command in question for f in $(<uploads); do . I only want this to execute if uploads is not empty. If uploads is empty I want the script to quit, actually before the for command. If its not apparent uploads is a text file. Chris (3 Replies)
Discussion started by: chrchcol
3 Replies

3. Shell Programming and Scripting

Help shell script to loop through files update ctl file to be sql loaded

I am currently trying to find a way to loop through files in a given directory and for each file modify a ctl file and sql load it. I have been using the sed command to change the infile, badfile parameters of the control file. I have not yet tried to sql load it. Requirement: files are ftp to... (1 Reply)
Discussion started by: dba_nh
1 Replies

4. Shell Programming and Scripting

waiting until file loaded

Hello i have DB file load with this command ../SS-Tools/SSdbload -r 10 -il /export/specbackup_db/$b y i should wait until the DB load completed then run the next command $SPECROOT/bin/launchinstdbapp `/usr/bin/hostname` SS n VNM.OUT how this can be done with shell scripting NB: i... (1 Reply)
Discussion started by: mogabr
1 Replies

5. UNIX for Dummies Questions & Answers

Problem executing find file command in Linux

When trying to find a list of files with specific text in them using find . -type f -exec grep -l "DataStage Job 4263" {}\; I get error find: missing argument to 'exec' How can I correct this ? I'm on Linux Red Hat. Cheers PS I'm a DataStage programmer not a systems support... (4 Replies)
Discussion started by: jackdaw_at_work
4 Replies

6. Shell Programming and Scripting

Check if file is loaded completely and then process the file

I need to write a script which checks for files loaded into a folder (files are loaded by ftp from other server) and process the file only if the file is loaded completely. if the file is not complete in the current run, it must be processed in the next run. Any suggestions would be welcome... (2 Replies)
Discussion started by: kalyan381
2 Replies

7. Shell Programming and Scripting

How to get total records loaded from sqlldr log file

Hi, I am loading data in the database table through sqlldr. I have to find total records loaded from sqlldr log file and store it in a variable in my script. How do I get it? Thank you. (3 Replies)
Discussion started by: mrpranab
3 Replies

8. Solaris

file just loaded does not appear to be executable

Hi When i m trying the boot the system with Primary HDD (c1t0d0s0) -- its solaris 10 I m getting an error "file just loaded does not appear to be executable".....So will anyone share the steps to recover from this stage I also tried to build the corrupted superblock from below command but... (0 Replies)
Discussion started by: taruntan
0 Replies

9. UNIX for Dummies Questions & Answers

Find command not executing for copying file

Buddies, I am trying to copy the file 'xcopyq' from /home/sandip to /home/sandip/testdir using the below command and getting the error as shown below:- sandip@manu:~$ find /home/sandip -type f -name '*xcopyq*' -exec cp{} /home/sandip/testdir/ \: find: missing argument to `-exec' Am I... (2 Replies)
Discussion started by: sandip250382
2 Replies

10. UNIX for Dummies Questions & Answers

Write pid and command name to a txt file while executing a bash script

Hi All, Just have a requirement, I am executing a bash shell script, my requirement is to catch the pid and job name to a txt file in the same directory, is there anyway to do it? please help me out. Regards Rahul ---------- Post updated at 08:42 AM ---------- Previous update was at... (2 Replies)
Discussion started by: rahulkalra9
2 Replies
FusionInventory::Agent::Tools::Linux(3pm)		User Contributed Perl Documentation		 FusionInventory::Agent::Tools::Linux(3pm)

NAME
FusionInventory::Agent::Tools::Linux - Linux generic functions DESCRIPTION
This module provides some generic functions for Linux. FUNCTIONS
getDevicesFromUdev(%params) Returns a list of devices, by parsing udev database. Availables parameters: logger a logger object getDevicesFromHal(%params) Returns a list of devices, by parsing lshal output. Availables parameters: logger a logger object command the exact command to use (default: /usr/sbin/lshal) file the file to use, as an alternative to the command getDevicesFromProc(%params) Returns a list of devices, by parsing /proc filesystem. Availables parameters: logger a logger object getCPUsFromProc(%params) Returns a list of cpus, by parsing /proc/cpuinfo file Availables parameters: logger a logger object file the file to use (default: /proc/cpuinfo) getInfoFromSmartctl(%params) Returns some information about a drive, using smartctl. Availables parameters: logger a logger object device the device to use file the file to use getInterfacesFromIfconfig(%params) Returns the list of interfaces, by parsing ifconfig command output. Availables parameters: logger a logger object command the command to use (default: /sbin/ifconfig -a) file the file to use getInterfacesFromIp(%params) Returns the list of interfaces, by parsing ip command output. Availables parameters: logger a logger object command the command to use (default: /sbin/ip addr show) file the file to use perl v5.14.2 2012-06-25 FusionInventory::Agent::Tools::Linux(3pm)
All times are GMT -4. The time now is 04:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy