Rotate logs

cLaSic -  
jipicy Messages postés 40842 Date d'inscription   Statut Modérateur Dernière intervention   -
Hello,

I wrote two bash scripts :

bash1.sh (will call bash2.sh and write logs to a daily file)
Code:

#!/bin/bash
./bash2.sh >> log`date +%d_%m_%y` 2>&1

bash2.sh (will loop indefinetly and write the current time)
Code:

#!/bin/bash
while [ 1 -eq 1 ]
do
date '+%H:%M:%S'
sleep 1
done

I'm expecting the logs to be written in a seperate file each day. But if you launch bash1.sh you will see that even if you change the system time, logs will be writte n in the same file :/

Any idea ? any hints are welcome.

Regards,
cLaSic

1 réponse

jipicy Messages postés 40842 Date d'inscription   Statut Modérateur Dernière intervention   4 896
 
Salut,

On peut savoir pourquoi tu causes anglais ? (newfire, Tael, snakes-creed, eux causant en français)
0