I am new to this forum. I have a script which randomly throws error.Following are steps followed in this script:
Generate Term file
Remove previous term and rpt files from utility directory.
copy term file to utility directory
call sql to generate rpt file using term file as input
copy the generated rpt file from run directory to utility directory.
I get error from sql as :
This happens when term file is not present in utility directory when sql is called.
Code snippet is shown below. Please ignore the syntax error, if any.
After script runs, if we check utility directory we can find term file
This error occurs randomly. Is there any chance system takes more time to copy the Term file to Utility directory and before completing the copy command, sql started running?
Moderator's Comments:
Thread moved. Please post in the correct forum ...
Am sorry. I did not include the code showing how nj.terms is created. My code is in remote desktop and hence i can not copy it here. nj.terms has data which is formatted like:
plan|hic|date.
Since nj.terms has contents, if condition is satisfied and run the following commands to remove and copy the files.
Good day. You originally posted:
However, you commands contradict your steps. For example, step #5 says to copy the generated SQL file from run directory to the utility directory. Yet, the copy command [CODE][cp utl/nj.RPT RUN_DIR/CODE] is contradicting that.
Additionally, you are dealing with relative paths instead of absolute paths (as previously point ed out) and there doesn't seem to be any error checking in case one of your steps fail (such as a rm or cp command).
You are also using references to /util in some lines and util/ in others... one being an absolute path, whilst the other is a relative path. Not to mention, are there two seperate files nj.rpt and nj.RPT ?
I would suggest you use absolute paths for starters. Additionally, the ; may be required after the ]] in your if then statement. Additionally, the RUN_DIR... is this a directory, or supposed to be a variable ?
If you fix up your variables and use absolute paths, that should rememdy your situation.
Last edited by Scrutinizer; 02-19-2015 at 11:56 AM..
Reason: Changed code tags to code tags
Hello.
I have a question as to why my grep command does not seem to be working.
grep -c '^?*' ~
grep -c '^.*' ~
I wanted to count the number of files starting with the letter K and have some letters after that. I have such files in my home directory. However, the output is 0. So, I have no... (2 Replies)
Hi,
I want to copy a file/directory ( recursively , if needed) and if destination directory does not exist create it ( with parent directory, if needed).
funcopy () {
if ; then
echo "$2 exists , copying files"
cp -r "$1" "$2"
else
echo "Directory does not exist;Create directory"
mkdir... (1 Reply)
need help, trying make a command where the user presses any keys and it will go to the home page, however it doesnt work, why ?
echo -p "press any key to return to main menu" menu
if ]; then
echo -p "\n"
home
fi (5 Replies)
Hi
I have a problem with scp command :
I try to copy a list of files from source to destination, it works fine but if there is a directory not existing on destination, it doesn't automatic create.
Syntax :
scp -rp /<PATH>/<NEW_DIR>/<FILE> <USER_DEST>@<HOST_DEST>:<PATH>/<NEW_DIR>/<FILE>... (5 Replies)
How can we copy a command string from a previous command line and paste it into the cursor position on the current command line? I know that ^c will not work as the shell will interpret as an interrupt signal.
Thanks, (1 Reply)
I am trying to copy a folder which contains a list of C executables.
It takes 2 mins for completion,where as the entire script takes only 3 more minutes for other process.
Is there a way to copy the folder faster so that the performance of the script will improve? (2 Replies)
at command does not work with graphic programs like firefox, evolution, etc
It works with other commands
for example:
at now
shutdown -h now
OK
but
at now
firefox
does not work
Anyone knows if its possible to open a firefox window at a scheduled time?
Thanks
Jose (0 Replies)
Command works but not in SH
At terminal if i type:
scp test.tar.gz user1@server2:/home/user
Everything run smoothly (keyed, no password need)
At script , test.sh
#!/bin/sh
scp test.tar.gz user1@server2:/home/user
Nothing happen and clue ? ? ? ? ? (3 Replies)
Good Day
I mistakely renamed the dld.sl file in the /usr/lib directory. When i try to ls/ftp into the box i get this error :eek:
crt0: ERROR couldn't open /usr/lib/dld.sl errno:000000002
I have tried to rename it back from the renamed file to the original file name, but it gives me the... (2 Replies)