User:Skooli

From WolfWiki
Revision as of 15:27, 1 December 2006 by Skooli (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ETTVd startscript modification

I modified my start.sh to dump old logfiles and clean up the working dir before starting ettvd. I "workarounded" it with linux cmds since i didnt want to install logrotate for that (and its just a few lines)

#!/bin/sh

# old logfile dumper
if [ -r nohup.out ]; then                     # only log if there exist old logfiles
   if [ ! -d logs ]; then                     # if the logs/ directory does not exist...
      mkdir logs                              # ...create it
      echo "dumping files for the first time - created directory logs/"
   fi

   filename=`date "+%Y.%m.%d-%H.%M.%S"`       # set the current date to the filename of the archive

   tar cf logs/$filename.tar nohup.out *.log  # tar it
   gzip logs/$filename.tar                    # zip it

   rm nohup.out *.log                         # delete old logs from working dir

   echo "dumped old logfiles to logs/$filename.tar.gz"
   echo " "
fi


# start ettvd
nice -n-4 su youruser -c "nohup php5 ettvd.php &"