From 2275037039e82a5dc2166803ea628ca81aaeaa40 Mon Sep 17 00:00:00 2001 From: llnu Date: Mon, 11 May 2020 12:22:40 +0200 Subject: [PATCH] Kinda finished --- .../type/__my_nginx_site/gencode-remote | 26 ++++++++++++++++--- .../dot-cdist/type/__my_nginx_site/manifest | 8 +++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/balazs/dot-cdist/type/__my_nginx_site/gencode-remote b/balazs/dot-cdist/type/__my_nginx_site/gencode-remote index c9eed7a..7a74b98 100644 --- a/balazs/dot-cdist/type/__my_nginx_site/gencode-remote +++ b/balazs/dot-cdist/type/__my_nginx_site/gencode-remote @@ -1,3 +1,23 @@ -if grep -q "^__your_type/object/id:conf_file_changed" "$__messages_in"; then - echo "service nginx reload" -fi \ No newline at end of file +os=$(cat "$__global/explorer/os") + +#if grep -q "$something_from_message_in" "$__messages_in"; then + +case "${os}" in + alpine|gentoo) + echo /etc/init.d/nginx reload + ;; + debian|ubuntu) + echo "/usr/bin/systemctl reload nginx" + ;; +esac + +#fi + + +#if grep -q "^__your_type/object/id:conf_file_changed" "$__messages_in"; then +# echo "$reload_command" +#fi + +# Testing env -> variables are not shared between the type's manifest and the gencode-remote script +# Maybe the variables are eval-ed on the local host and won't get transferred to the remote host? +#echo "echo \"$reload_command\" >> /tmp/cmd" \ No newline at end of file diff --git a/balazs/dot-cdist/type/__my_nginx_site/manifest b/balazs/dot-cdist/type/__my_nginx_site/manifest index d7bbca2..0dbfbb6 100644 --- a/balazs/dot-cdist/type/__my_nginx_site/manifest +++ b/balazs/dot-cdist/type/__my_nginx_site/manifest @@ -1,3 +1,8 @@ +os="$(cat "$__global/explorer/os")" + +# Note: __service nginx --action reload + + domain="$__object_id" nginx_config_dir="/etc/nginx/conf.d" @@ -15,4 +20,5 @@ server { } EOF -echo "conf_file_changed" >> "$__messages_out" \ No newline at end of file +# Messaging is not needed because atm I assume that the config file will get overwritten every run, even if the contents are the same. +#echo "conf_file_changed" >> "$__messages_out" \ No newline at end of file