script permission error


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers script permission error
# 1  
Old 03-03-2008
script permission error

I am writing a VERY simple script that copies my catalina log file to a new filename then copies /dev/null inotthe catalina.out. Since the log is the live log, it is open and written to as I copy. I can do the 2 copy commands from a command promp with no problem, it works. I have the probmel in the following script

cp /home/apache/logs/catalina.out /home/apache/logs/catalina.out_`date +%D`
cp /dev/null /home/apache/logs/catalina.out

I get this error in the script ONLY command line works

cp: catalina.out_03/03/08: No such file or directory

I tried to touch the file to copy to first and use the force.. no luck. My ID ownes the directory and the directory is 775. There should be no problem with permissions, it just will not let me ccreate a new file using the cp command in a script. I can with the same ID do it from command line. How do I get this to work in a script so I can cron it up?
# 2  
Old 03-03-2008
You cant use "/" in file name ...
# 3  
Old 03-04-2008
Yes, avoid using "/" in filename, you may try to date format as

`date +%m%d%y`
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pipe, permission denied error

Hello, I am trying to stream lines written into file. When first source is down, I expect the code to swap to second line and run it. Script below works as usual and it prints out each line of the input file (s.txt): #!/bin/bash while read -r line; do echo "$line" done <"$1" exit 0Output... (12 Replies)
Discussion started by: baris35
12 Replies

2. Programming

Permission error while using execve..

Hi, I have the following scenario.. 1) I have a binary which i launch from command line. It executes fine. 2) But when I launch it from another file using execve command, it gives a message that it is not able to access a shared object ".so" in /usr/bin (message is "Permission... (4 Replies)
Discussion started by: sathish1000
4 Replies

3. UNIX for Dummies Questions & Answers

Webserver permission denied error

Hello, I was trying a perl-cgi tutorial and saving the data from online form to a file named (guests.txt). I am using the localhost port 80 for practice. My page file "guestbook.html" is working as I saw the online form. After filled out the blanks and submit, I was expecting to see the result... (3 Replies)
Discussion started by: yifangt
3 Replies

4. OS X (Apple)

Permission Denied Error with X11

Hello, I am using Tiger 10.4.11 I am trying out the GIMP, so I installed the X11 package from "Optional Installs" on the cd. Whenever I open X11, I get an error: xterm: could not exec /dev/null: Permission denied I have chmodded /dev/null to 777, as well as the /tmp directory. I deleted... (2 Replies)
Discussion started by: Ricardo-san
2 Replies

5. UNIX for Dummies Questions & Answers

Permission error

for FNAME in `find /unixsxxx/interface/2.0/xxxxxxx -type f \( -name '*.KSH' -o -name '*.sh' -o -name '*.sql' -o -name '*.ksh' \) -exec grep -il xxx.xxx.xxx.xxx {} \;`; do C=`grep -c xxx.xxx.xxx.xxx ${FNAME}`; echo "${C}:${FNAME}" >> /unixsxxx/apps/41.txt;done How to avoid my command from... (2 Replies)
Discussion started by: TimHortons
2 Replies

6. UNIX for Advanced & Expert Users

Script without read permission but execute the script

I have a script, except me no one can read the script but they can execute the script. Is it possible? (14 Replies)
Discussion started by: kingganesh04
14 Replies

7. Shell Programming and Scripting

ssh command in ksh script encounters permission error

I've created a script and copied it to another server and try to execute it at the same time but I'm getting a permission error. I'm logged on as root and I gave the file 777 permission when I created it, but I can't run it remotely via ssh command because of permission issue. Any ideas? ... (5 Replies)
Discussion started by: pdtak
5 Replies

8. Shell Programming and Scripting

xterm gives me permission denied error

When I try to run xterm at a command prompt in solaris 2.5.1, i'm getting a permission denied error. But the directory and user permissions look ok, they are part of a users group and then also root,sys,adm so what gives? Any ideas? Thanks! (1 Reply)
Discussion started by: kymberm
1 Replies

9. UNIX for Advanced & Expert Users

getcwd: permission denied error

When I do a 'cd /appl' and issue 'ls -al' command, I get the following error for .. directory. ./..: Permission denied But still I get a listing of other directories under /appl. Also, if I give 'man' for any command under this /appl folder, I get the following error: ... (3 Replies)
Discussion started by: Deepa
3 Replies

10. UNIX for Dummies Questions & Answers

rm Permission Denied error

I am very new to Unix. We have a script that will remove files from a directory. The account removing the files has the same permissions as the directory the files are located. We have logged in as the account and deleted the files from that directory but when we run the script with the account... (7 Replies)
Discussion started by: Cech2002
7 Replies
Login or Register to Ask a Question