1 | 1 | simandl | #!/usr/bin/env sh |
2 | | | |
3 | | | . ./settings |
4 | | | |
5 | | | if [ "$1" = "" ]; then |
6 | | | echo "Usage:" |
7 | | | echo "clearall <SINGLE OPTION>" |
8 | | | echo "" |
9 | | | echo "Options:" |
10 | | | echo " CLEAR_DATABASES" |
11 | | | echo " removes ALL .rrd database files!" |
12 | | | echo " CAUTION! ALL SAMPLED DATA WILL BE LOST!!!" |
13 | | | echo "" |
14 | | | echo " CLEAR_WEBPAGE" |
15 | | | echo " removes all webgraphs" |
16 | | | echo "" |
17 | | | echo " CLEAR_GRAPHS" |
18 | | | echo " removes temporary files for webgraphs" |
19 | | | echo "" |
20 | | | echo " CLEAR_COUNTERS" |
21 | | | echo " removes temporary files used to build the databases" |
22 | | | echo "" |
23 | | | echo " CLEAR_BINARIES" |
24 | | | echo " removes compiled perls and re-installs the original" |
25 | | | echo " scripts" |
26 | | | echo "" |
27 | | | echo " CLEAR_EVERYTHING" |
28 | | | echo " does all of the things above" |
29 | | | echo "" |
30 | | | fi |
31 | | | |
32 | | | if [ "$1" = "CLEAR_BINARIES" ]; then |
33 | | | echo "This will slow down script-execution. Enter yes to continue" |
34 | | | read nn |
35 | | | if [ "$nn" = "yes" ]; then |
36 | | | for nn in ./modules/*; do |
37 | | | rm -f $nn/read-data |
38 | | | done |
39 | | | fi |
40 | | | fi |
41 | | | |
42 | | | if [ "$1" = "CLEAR_DATABASES" ]; then |
43 | | | echo "This will destroy all sampled data. Enter yes to continue" |
44 | | | read nn |
45 | | | if [ "$nn" = "yes" ]; then |
46 | | | rm -rf modules/*/rrd |
47 | | | fi |
48 | | | fi |
49 | | | |
50 | | | if [ "$1" = "CLEAR_WEBPAGE" ]; then |
51 | | | if [ -e $WEBDIR ]; then |
52 | | | echo "This will destroy everything under $WEBDIR and therefore your web-graphs. Enter yes to continue" |
53 | | | read nn |
54 | | | if [ "$nn" = "yes" ]; then |
55 | | | cd $WEBDIR |
56 | | | rm -f */*.html */*.gif */*.png *.html *.gif *.png convert |
57 | | | rmdir * |
58 | | | fi |
59 | | | fi |
60 | | | fi |
61 | | | |
62 | | | if [ "$1" = "CLEAR_GRAPHS" ]; then |
63 | | | rm -rf modules/*/*.gif modules/*/*.png modules/*/expires modules/*/idxdata modules/*/index index.html |
64 | | | fi |
65 | | | |
66 | | | if [ "$1" = "CLEAR_COUNTERS" ]; then |
67 | | | rm -f */*/*.dat */*/*.old *.log |
68 | | | fi |
69 | | | |
70 | | | if [ "$1" = "CLEAR_EVERYTHING" ]; then |
71 | | | echo "This will destroy all sampled data and delete all pre-compiled PERL-scripts and clear the webpage output. Enter yes to continue" |
72 | | | read nn |
73 | | | if [ "$nn" = "yes" ]; then |
74 | | | rm -rf modules/*/rrd |
75 | | | fi |
76 | | | for nn in ./modules/*; do |
77 | | | rm -f $nn/read-data |
78 | | | done |
79 | | | rm -f nohup.out |
80 | | | rm -rf modules/*/*.png modules/*/*.gif modules/*/expires modules/*/idxdata modules/*/index index.html |
81 | | | rm -f */*/*.dat */*/*.old *.log |
82 | | | cd $WEBDIR |
83 | | | rm -f */*.html */*.gif */*.png *.html *.gif *.png convert |
84 | | | rmdir * |
85 | | | fi |
86 | | | |