-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript
More file actions
122 lines (98 loc) · 2.66 KB
/
script
File metadata and controls
122 lines (98 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
# This script will create files and directories for the web server and website, as well as set permissions for everything.
# Author: alogan
echo "---------- First the directories... ----------"
cd /home
echo "Here are the contents of the current directory: "
pwd
ls -l
INSTALL_DIR='/home/andyl/apache'
echo $INSTALL_DIR
echo ""
if test -d $INSTALL_DIR
then
echo "Directory INSTALL_DIR exists. Here's the long listing: "
chmod -R 750 $INSTALL_DIR
ls -l $INSTALL_DIR
else
echo "Directory did not exist yet."
mkdir $INSTALL_DIR
mkdir $INSTALL_DIR/bin
mkdir $INSTALL_DIR/conf
mkdir $INSTALL_DIR/lib
chmod -R 750 $INSTALL_DIR
echo "Now the directory exists!"
ls -l $INSTALL_DIR
fi
echo ""
WWW_DIR='/home/andyl/www'
echo $WWW_DIR
if test -d $WWW_DIR
then
echo "Directory WWW_DIR exists. Here's the long listing: "
chmod -R 750 $WWW_DIR
chmod 772 $WWW_DIR/ftp
ls -l $WWW_DIR
else
echo "Directory did not exist yet."
mkdir $WWW_DIR
mkdir $WWW_DIR/html
mkdir $WWW_DIR/cgi-bin
mkdir $WWW_DIR/ftp
chmod -R 750 $WWW_DIR
chmod 772 $WWW_DIR/ftp
echo "Now the directory exists!"
ls -l $WWW_DIR
fi
echo ""
echo "---------- Now for the files... ----------"
echo ""
if test -f $INSTALL_DIR/bin/httpd.conf
then
echo "File httpd.conf exists."
chmod 664 $INSTALL_DIR/bin/httpd.conf
ls -l $INSTALL_DIR/bin
else
echo "File httpd.conf does not exist yet."
touch $INSTALL_DIR/bin/httpd.conf
chmod 664 $INSTALL_DIR/bin/httpd.conf
echo "Now the file exists!"
ls -l $INSTALL_DIR/bin
fi
echo ""
if test -f $WWW_DIR/html/index.html
then
echo "File index.html exists."
chmod 644 $WWW_DIR/html/index.html
ls -l $WWW_DIR/html
else
echo "File index.html does not exist yet."
touch $WWW_DIR/html/index.html
chmod 644 $WWW_DIR/html/index.html
echo "Now the file exists!"
ls -l $WWW_DIR/html
fi
echo ""
if test -f $WWW_DIR/cgi-bin/process.pl
then
echo "File process.pl exists."
chmod 711 $WWW_DIR/cgi-bin/process.pl
ls -l $WWW_DIR/cgi-bin
else
echo "File process.pl does not exist yet."
touch $WWW_DIR/cgi-bin/process.pl
chmod 711 $WWW_DIR/cgi-bin/process.pl
echo "Now the file exists!"
ls -l $WWW_DIR/cgi-bin
fi
echo ""
echo "---------- Now let's look inside of the file httpd.conf... ----------"
echo ""
echo This This is the main Apache HTTP server configuration file. It contains the configuration directives that give the server its instructions. > $INSTALL_DIR/bin/httpd.conf
echo "Contents of httpd.conf: "
cat $INSTALL_DIR/bin/httpd.conf
echo ""
echo "Here are the contents of the INSTALL_DIR: "
ls -l $INSTALL_DIR
echo "Directory installed at /home/usr/apache"
echo "End."