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?