X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fsystem%2Fcommon_sysadmin.sh;h=0deb72574e5f0c68fb7268bd1920ed146cc764fc;hb=baf5d7c693e351bd775114380dc0111bc3e4028e;hp=223067f6ce7443b56f2fc929c94613ec55773910;hpb=20e64501b4305ee07f5b765ad3b8efd7740f2ec1;p=feisty_meow.git diff --git a/scripts/system/common_sysadmin.sh b/scripts/system/common_sysadmin.sh index 223067f6..0deb7257 100644 --- a/scripts/system/common_sysadmin.sh +++ b/scripts/system/common_sysadmin.sh @@ -17,7 +17,7 @@ function remove_domain_file() if [ -f "$domain_file" ]; then # don't destroy, just shuffle. \mv -f "$domain_file" "/tmp/$(basename ${domain_file})-old-${RANDOM}" - test_or_die "removing domain file: $domain_file" + exit_on_error "removing domain file: $domain_file" else echo "Did not see a domain file to remove: $domain_file" fi @@ -61,7 +61,7 @@ ${domain_name}. IN A ${IP_ADDRESS} # our personalized configuration approach wants the real owner to own the file. chown "$(logname):$(logname)" $domain_file - test_or_die "setting ownership on: $domain_file" + exit_on_error "setting ownership on: $domain_file" } # takes a zone back out of the local conf file for bind @@ -100,7 +100,7 @@ zone \"${domain_name}\" in { # keep ownership for the real user. chown "$(logname):$(logname)" /etc/bind/named.conf.local - test_or_die "setting ownership on: /etc/bind/named.conf.local" + exit_on_error "setting ownership on: /etc/bind/named.conf.local" } # zaps a subdomain out of the containing domain file. @@ -170,7 +170,7 @@ function add_new_subdomain() # keep ownership for real user. chown "$(logname):$(logname)" "/etc/bind/${containing_domain}.conf" - test_or_die "setting ownership on: /etc/bind/${containing_domain}.conf" + exit_on_error "setting ownership on: /etc/bind/${containing_domain}.conf" } function restart_bind() @@ -181,7 +181,26 @@ function restart_bind() echo "The bind service did not restart properly. Please check the error logs." exit 1 fi - echo DNS server restarted. + echo DNS service restarted. +} + +############################################################################ + +# samba server helper functions... + +function restart_samba +{ + echo restarting samba server. + service smbd restart + if [ $? -ne 0 ]; then + echo "The samba service did not restart properly. Please check the error logs." + exit 1 + fi + service nmbd restart + if [ $? -ne 0 ]; then + echo "The samba name service (nmbd) did not restart properly. This may not always be fatal, so we are ignoring it, but you may want to check the error logs." + fi + echo samba service restarted. } ############################################################################ @@ -198,7 +217,7 @@ function remove_apache_config() if [ -f "$site_config" ]; then # don't destroy, just shuffle. \mv -f "$site_config" "/tmp/$(basename ${site_config})-old-${RANDOM}" - test_or_die "removing site config: $site_config" + exit_on_error "removing site config: $site_config" else echo "Did not see a site config to remove: $site_config" fi @@ -259,7 +278,7 @@ function write_apache_config() " >"$site_config" chown "$(logname):$(logname)" "$site_config" - test_or_die "setting ownership on: $site_config" + exit_on_error "setting ownership on: $site_config" } # stops apache from serving up the site. @@ -317,6 +336,7 @@ function restart_apache() echo "Please consult the apache error logs for more details." exit 1 fi + echo Apache2 service restarted. } # sets up the serverpilot storage location for a user hosted web site. @@ -327,7 +347,7 @@ function maybe_create_site_storage() local full_path="$BASE_APPLICATION_PATH/$our_app" if [ ! -d "$full_path" ]; then mkdir -p $full_path - test_or_die "The app storage path could not be created.\n Path in question is: $full_path" + exit_on_error "The app storage path could not be created.\n Path in question is: $full_path" fi # now give the web server some access to the folder. this is crucial since the folders @@ -339,10 +359,10 @@ function maybe_create_site_storage() while [[ $chow_path != $HOME ]]; do #echo chow path is now $chow_path chmod g+rx "$chow_path" - test_or_die "Failed to add group permissions on the path: $chow_path" + exit_on_error "Failed to add group permissions on the path: $chow_path" # reassert the user's ownership of any directories we might have just created. chown $(logname) "$chow_path" - test_or_die "changing ownership to user failed on the path: $chow_path" + exit_on_error "changing ownership to user failed on the path: $chow_path" chow_path="$(dirname "$chow_path")" done }