Sponsored Content
Full Discussion: EXEC error
Top Forums Shell Programming and Scripting EXEC error Post 302257834 by Raamc on Thursday 13th of November 2008 07:02:41 AM
Old 11-13-2008
EXEC error

Hi,

In my script i need to output the STDOUT and STDERR messages to a log file.

my code is as below.

------------------------------------------------------------------------
LogDate=`date "+%Y%m%d"`
LogDirectory=`grep -w LogDirectory ${ParameterFile}|cut -d "=" -f2`
LogFileName="${LogDirectory}/${LogDate}.txt"

exec >${LogFileName}
exec 2>${LogFileName}
------------------------------------------------------------------------

When i run the script it is giving the error as
A file or directory in the path name does not exist.
script.sh[64]: /projects/logs/20081113.txt: 0403-005 Cannot create the specified file.


I have access to create the files in /projects/logs location. I tried manually by creationg the files and sucessfull. But when i try to create a log file by running the script it is giving the error.

Any ideas please?

Thanks,
Raamc.
 

10 More Discussions You Might Find Interesting

1. AIX

Exec of 'dbupgrade' returned non-zero status of '0x1' error

After upgrading to IS 4.0 Sp4 I am now recieving an error when running initfnsw start Exec of 'dbupgrade' returned non-zero status of '0x1' This error appears right after trying to start the Oracle Database. This stops the FileNet software from starting. After many different attempts at... (0 Replies)
Discussion started by: jderocco
0 Replies

2. UNIX for Dummies Questions & Answers

find command exec error

Hi All, i am writing a shell script in korn shell which deletes all the files in a directory once in every 10DAYS. the directory has different format files. the script has something like this; cd /home/data/pavi echo "Please Enter the Number of Days to search for" read DAYS... (2 Replies)
Discussion started by: pavan_test
2 Replies

3. UNIX for Advanced & Expert Users

UNIX Backup Exec Agent Error

Hello, When launching a recently installed UNIX agent for my Veritas backup exec server I receive "getservbyname (grfs, tcp) failed!" I have checked to make sure the service exists under port 6101 and its there. I also removed and recreated the service but still no go. :confused: :confused:... (2 Replies)
Discussion started by: George26
2 Replies

4. UNIX for Dummies Questions & Answers

find .... -exec rm .... \; works, but gives an error

I am using find to get all the instances of a given directory name, then remove those directories with a -exec rm command. here is an example: mkdir -p foo/bar find foo -name bar -exec rm -rf {} \; foo will get deleted as I desired, however this pops out on standard error: find: foo/bar:... (3 Replies)
Discussion started by: Afifi
3 Replies

5. Shell Programming and Scripting

Help with use of `` vs exec

Hi all, I had an issue regarding use of `` or exec in perl . `` are considered to be unsafe. Why? In my case an user would be giving some parameters as input and I will form an command of it and execute it using ``. It is important to capture output as i have to parse the output. As well as I need... (0 Replies)
Discussion started by: bharadiaam
0 Replies

6. Shell Programming and Scripting

exec script error

Hi, Gurus, my script code as following: #!/usr/bin/sh mkdir dir1 result=`echo $?` if ; then echo "completed" else echo "wrong" fi When I execute it with command sh filename. , it executed successfully. but, when I execute it with command . filename it throw out error: -bash:ELF :... (2 Replies)
Discussion started by: ken002
2 Replies

7. UNIX for Advanced & Expert Users

find -exec with 2 commands doesn't work (error incomplete staement)

Hi Gurues, I need to modify an existing script that uses find to search a folder, and then move its contents to a folder. What I need to do is run gzip on each file after it's moved. So, I ran this little test: Put a ls.tar file on my $HOME, mkdir tmp, and then: virtuo@tnpmprd01: find .... (3 Replies)
Discussion started by: llagos
3 Replies

8. Shell Programming and Scripting

using rm with find -exec gives error

Greetings, Everytime I use rm with find I get errors like find: ./test: No such file or directory For exemple : hostname> mkdir test hostname> ls test hostname> find . -type d -name test -exec rm -rf {} \; find: ./test: No such file or directory hostname>ls hostname> echo $? 1 ... (2 Replies)
Discussion started by: Sekullos
2 Replies

9. Shell Programming and Scripting

Script Variables Inquiry, Values Okay in Standalone Exec, No-Show in Cron Exec

I have the following bash script lines in a file named test.sh. #!/bin/bash # # Write Date to cron.log # echo "Begin SSI Load $(date +%d%b%y_%T)" # # Get the latest rates file for processing. # d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1) filename=$d export filename... (3 Replies)
Discussion started by: ginowms
3 Replies

10. Shell Programming and Scripting

Executing perl script in Linux gives :Exec format error. Wrong Architecture

i have perl script that used to be working great , once i edit it in windows and convert it to UTF-8 and then via FTP return it . also did: chmod +x foo.pl and then when i try to run it : ./foo.pl im getting this error: ./foo.pl: Exec format error. Wrong Architecture.... (4 Replies)
Discussion started by: umen
4 Replies
EXEC(P) 						     POSIX Programmer's Manual							   EXEC(P)

NAME
exec - execute commands and open, close, or copy file descriptors SYNOPSIS
exec [command [argument ...]] DESCRIPTION
The exec utility shall open, close, and/or copy file descriptors as specified by any redirections as part of the command. If exec is specified without command or arguments, and any file descriptors with numbers greater than 2 are opened with associated redi- rection statements, it is unspecified whether those file descriptors remain open when the shell invokes another utility. Scripts concerned that child shells could misuse open file descriptors can always close them explicitly, as shown in one of the following examples. If exec is specified with command, it shall replace the shell with command without creating a new process. If arguments are specified, they shall be arguments to command. Redirection affects the current shell execution environment. OPTIONS
None. OPERANDS
See the DESCRIPTION. STDIN
Not used. INPUT FILES
None. ENVIRONMENT VARIABLES
None. ASYNCHRONOUS EVENTS
Default. STDOUT
Not used. STDERR
The standard error shall be used only for diagnostic messages. OUTPUT FILES
None. EXTENDED DESCRIPTION
None. EXIT STATUS
If command is specified, exec shall not return to the shell; rather, the exit status of the process shall be the exit status of the program implementing command, which overlaid the shell. If command is not found, the exit status shall be 127. If command is found, but it is not an executable utility, the exit status shall be 126. If a redirection error occurs (see Consequences of Shell Errors ), the shell shall exit with a value in the range 1-125. Otherwise, exec shall return a zero exit status. CONSEQUENCES OF ERRORS
Default. The following sections are informative. APPLICATION USAGE
None. EXAMPLES
Open readfile as file descriptor 3 for reading: exec 3< readfile Open writefile as file descriptor 4 for writing: exec 4> writefile Make file descriptor 5 a copy of file descriptor 0: exec 5<&0 Close file descriptor 3: exec 3<&- Cat the file maggie by replacing the current shell with the cat utility: exec cat maggie RATIONALE
Most historical implementations were not conformant in that: foo=bar exec cmd did not pass foo to cmd. FUTURE DIRECTIONS
None. SEE ALSO
Special Built-In Utilities COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 EXEC(P)
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy