#!/bin/ksh # ----------------------------------------------------------------------------- # Nom du script : purge_nohup_out.ksh Auteur : B. LISAN Date : 09/06/10 # But : si taille du "/root/nohup.out" depasse > ~ 100Mo => on purge le fichier # Condition execution : cron date/heure execution : chaque 1er du mois a 0h00 # 0 0 1 * * * /var/tmp/btsys/purge_nohup_out.ksh >/dev/null 2>&1 # version pour Linux # ----------------------------------------------------------------------------- TAILLE_MAX=102400 # en Ko (correspond a 100Mo) # taille de "/root/nohup.out" en Ko taille_nohup_out=` /usr/bin/du -k /root/nohup.out | /usr/bin/awk '{print $1}'` # si la taille du fichier est superieur ~ a 100Mo, on le purge if [ "$taille_nohup_out" -gt $TAILLE_MAX ] then > /root/nohup.out fi