16 from __future__
import print_function
20 RewriteCond %{HTTP:Accept-Encoding} gzip 21 RewriteRule (.*)\.html$ $1\.htmlgz [L] 22 RewriteRule (.*)\.png$ $1\.pnggz [L] 24 AddType "text/html;charset=UTF-8" .htmlgz 25 AddEncoding gzip .htmlgz 27 AddType "image/png" .pnggz 28 AddEncoding gzip .pnggz 30 DirectoryIndex RelMonSummary.htmlgz 35 from os.path
import exists
37 from sys
import argv,exit
42 print(
"Usage: %prog directoryname")
47 while directory[-1]==
"/": directory= directory[:-1]
49 if not exists(directory):
50 print(
"Directory %s does not exist: aborting!"%directory)
53 print(
"Moving pkls away...")
54 pkl_dir=
"%s_pkls" %directory
55 system(
"mkdir %s" %pkl_dir)
56 system(
"mv %s/*pkl %s" %(directory,pkl_dir))
57 print(
"All pkls moved in directory %s" %pkl_dir)
59 print(
"Backupping directory %s" %directory)
60 system(
"cp -r %s %s_back"%(directory,directory))
63 print(
"Gzipping content of %s" %directory)
64 system(
"time gzip -r -S gz %s"%directory)
65 print(
"Content of %s zipped!" %directory)
67 print(
"Adding .htaccess file...")
68 htaccess=open(
"%s/.htaccess"%directory,
"w")
69 htaccess.write(htaccess_content)
71 print(
"Apache .htaccess file successfully added!")
S & print(S &os, JobReport::InputFile const &f)