summaryrefslogtreecommitdiff
path: root/new-site.php
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2017-08-20 04:18:13 +0100
committerFbenas <philbeansburton@gmail.com>2017-08-20 04:18:13 +0100
commit0ed82a2c6ffd8e981d9dd388306379941ecb5720 (patch)
tree52c7d66149a93c7d4d8038d356bb0107bad09766 /new-site.php
parent048634fd8a65d37f21bcb3a34161f74be6aef95d (diff)
WIP rejigging stuff
Diffstat (limited to 'new-site.php')
-rw-r--r--new-site.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/new-site.php b/new-site.php
index 0568f8a..53e593d 100644
--- a/new-site.php
+++ b/new-site.php
@@ -5,18 +5,17 @@
// Nginx conf
// Git repo
// Directory structure
-
// Handle options
$options = getopt('d:n:');
if (!array_key_exists('d', $options)) {
- echo "please provide a domain (-d)\n";
- exit(1);
+ echo "please provide a domain (-d)\n";
+ exit(1);
}
if (!array_key_exists('n', $options)) {
- echo "please provide a name (-n)\n";
- exit(1);
+ echo "please provide a name (-n)\n";
+ exit(1);
}
$domain = $options['d'];
@@ -29,23 +28,23 @@ $conf = sprintf($conf[0], $domain, $name, $name, $name, $name, $name);
echo "Making directory structure\n";
if (!mkdir('/web/sites/' . $name)) {
- echo "Failed to create '/web/sites/'" . $name . "\n";
- exit(1);
+ echo "Failed to create '/web/sites/'" . $name . "\n";
+ exit(1);
}
chown('/web/sites/' . $name, "nginx");
if (!mkdir('/web/sites/' . $name . '/logs')) {
- echo "Failed to create '/web/sites/'" . $name . "/logs\n";
- exit(1);
+ echo "Failed to create '/web/sites/'" . $name . "/logs\n";
+ exit(1);
}
chown('/web/sites/' . $name . '/logs', "nginx");
if (!mkdir('/web/sites/' . $name . '/web')) {
- echo "Failed to create '/web/sites/'" . $name . "/web\n";
- exit(1);
+ echo "Failed to create '/web/sites/'" . $name . "/web\n";
+ exit(1);
}
chown('/web/sites/' . $name . '/logs', "nginx");
@@ -53,7 +52,7 @@ chown('/web/sites/' . $name . '/logs', "nginx");
echo "Complete\n";
if (!file_put_contents("/web/etc/nginx/" . $name . ".conf", $conf)) {
- echo "Failed to write nginx conf\n";
+ echo "Failed to write nginx conf\n";
}
chown('/web/etc/nginx/' . $name . ".conf", "nginx");