From 43ccb073e29f19f02d3c26560f07cba7015f7d99 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 4 Jun 2014 17:25:52 +0530 Subject: [PATCH] service start/stop/status/reload added --- src/lib/ee_lib_service.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/lib/ee_lib_service.sh diff --git a/src/lib/ee_lib_service.sh b/src/lib/ee_lib_service.sh new file mode 100644 index 00000000..e0a34792 --- /dev/null +++ b/src/lib/ee_lib_service.sh @@ -0,0 +1,24 @@ +# Services Start/Stop/Restart/Reload +# ee_lib_service nginx start +# ee_lib_service nginx stop +# ee_lib_service nginx restart +# ee_lib_service nginx php5-fpm mysql postfix restart + +function ee_lib_service() +{ + for ee_service_name in $@; do + if [ $ee_service_name != ${@: -1} ]; then + + # Check nginx and php5-fpm test before start/stop/restart/reload + if [ $ee_service_name = "nginx" ] || [ $ee_service_name = "php5-fpm" ]; then + $ee_service_name -t &> EE_COMMAND_LOG \ + && service $ee_service_name ${@: -1} \ + || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? + else + service $ee_service_name ${@: -1} \ + || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? + fi + + fi + done +} \ No newline at end of file