Create log file
Solved
yacleouf
Posted messages
461
Status
Member
-
yacleouf Posted messages 461 Status Member -
yacleouf Posted messages 461 Status Member -
Hello,
I’m coming back once again to the forum to ask a question about the shell that I absolutely know nothing about…
My problem may seem easy to you… not for me :-)
so here is this small shell program I have:
#!/bin/bash
workFolder=$(readlink -f $(dirname $0))
touch Log-'date +%Y%m%d'.log
LOGFILE=Log-'date +%Y%m%d'.log
find /var/ftp/TestArchivage/Archive -mtime +60 -type f -name "*.xml" -exec rm -f {} +
I tried these two solutions
$workFolder"/"$LOGFILE tee -a 2>&1 $workFolder"/"$LOGFILE
But neither works and each time it tells me Permission denied,
I tried to chmod 777 on the log file but still nothing is written inside…
A little help wouldn’t be refused ^^
Thanks in advance!
Configuration: VGN-cs21S, Windows 7 Professional 64-bit
--
Google is your friend!
I’m coming back once again to the forum to ask a question about the shell that I absolutely know nothing about…
My problem may seem easy to you… not for me :-)
so here is this small shell program I have:
#!/bin/bash
workFolder=$(readlink -f $(dirname $0))
touch Log-'date +%Y%m%d'.log
LOGFILE=Log-'date +%Y%m%d'.log
find /var/ftp/TestArchivage/Archive -mtime +60 -type f -name "*.xml" -exec rm -f {} +
I tried these two solutions
$workFolder"/"$LOGFILE tee -a 2>&1 $workFolder"/"$LOGFILE
But neither works and each time it tells me Permission denied,
I tried to chmod 777 on the log file but still nothing is written inside…
A little help wouldn’t be refused ^^
Thanks in advance!
Configuration: VGN-cs21S, Windows 7 Professional 64-bit
--
Google is your friend!
2 answers
Hello,
--
Zen my nuggets ;-)
Take a step for the environment, close your windows and adopt a penguin.
find /var/ftp/TestArchivage/Archive -mtime +60 -type f -name "*.xml" -exec rm -f {} + > ${workFolder}/${LOGFILE} 2>&1 --
Zen my nuggets ;-)
Take a step for the environment, close your windows and adopt a penguin.
Hi zipe31,
I just tried what you bolded, but nothing works...
Here is an excerpt of a log line for reference:
- rw-r--r--. 1 root root 0 Jun 17 17:24 Log-20130617.log
My log file isn’t filling up...
P.S. I do have old files dating from last year.
--
Google is your friend!
I just tried what you bolded, but nothing works...
Here is an excerpt of a log line for reference:
- rw-r--r--. 1 root root 0 Jun 17 17:24 Log-20130617.log
My log file isn’t filling up...
P.S. I do have old files dating from last year.
--
Google is your friend!
Attention, in my last message, I added a "echo" to see what the command was doing and to guard against accidental deletion ;-(
That’s actually a good habit to adopt, especially with the "rm" command ;-\
You can also add the "-v" option to the "rm" command to make it more verbose...
That’s actually a good habit to adopt, especially with the "rm" command ;-\
You can also add the "-v" option to the "rm" command to make it more verbose...