From 0ed82a2c6ffd8e981d9dd388306379941ecb5720 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sun, 20 Aug 2017 04:18:13 +0100 Subject: WIP rejigging stuff --- new-site.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'new-site.php') 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"); -- cgit v1.2.3