From 5419c23f62f784804de1376369a4bc6392f1534e Mon Sep 17 00:00:00 2001 From: neil Date: Mon, 28 Dec 2015 11:49:22 +0800 Subject: [PATCH 1/2] minor, fix install messages --- le.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/le.sh b/le.sh index 89cdc70b..66912fcc 100755 --- a/le.sh +++ b/le.sh @@ -512,28 +512,28 @@ renewAll() { install() { _initpath - if ! command -v "curl" ; then - _info "Please install curl first." - _info "Ubuntu: sudo apt-get install curl" - _info "CentOS: yum install curl" + if ! command -v "curl" > /dev/null ; then + _err "Please install curl first." + _err "Ubuntu: sudo apt-get install curl" + _err "CentOS: yum install curl" return 1 fi - if ! command -v "crontab" ; then - _info "Please install crontab first." - _info "CentOs: yum -y install crontabs" + if ! command -v "crontab" > /dev/null ; then + _err "Please install crontab first." + _err "CentOs: yum -y install crontabs" return 1 fi - if ! command -v "openssl" ; then - _info "Please install openssl first." - _info "CentOs: yum -y install openssl" + if ! command -v "openssl" > /dev/null ; then + _err "Please install openssl first." + _err "CentOs: yum -y install openssl" return 1 fi - if ! command -v "xxd" ; then - _info "Please install xxd first." - _info "CentOs: yum install vim-common" + if ! command -v "xxd" > /dev/null ; then + _err "Please install xxd first." + _err "CentOs: yum install vim-common" return 1 fi @@ -553,10 +553,10 @@ install() { _info "Installing cron job" if ! crontab -l | grep 'le.sh renewAll' ; then crontab -l | { cat; echo "0 0 * * * le.sh renewAll"; } | crontab - - if command -v crond ; then - service cron reload + if command -v crond > /dev/null ; then + service crond reload 2>/dev/null else - service cron restart + service cron reload 2>/dev/null fi fi From ae5f79d80a7af44edaca298128f013616320abf8 Mon Sep 17 00:00:00 2001 From: neil Date: Mon, 28 Dec 2015 11:52:36 +0800 Subject: [PATCH 2/2] minor, fix uninstall messages. --- le.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/le.sh b/le.sh index 66912fcc..23afae3d 100755 --- a/le.sh +++ b/le.sh @@ -567,8 +567,16 @@ install() { uninstall() { _initpath _info "Removing cron job" - crontab -l | sed "/le.sh renewAll/d" | crontab - - + + if ! crontab -l | grep 'le.sh renewAll' ; then + crontab -l | sed "/le.sh renewAll/d" | crontab - + if command -v crond > /dev/null ; then + service crond reload 2>/dev/null + else + service cron reload 2>/dev/null + fi + fi + _info "Removing /bin/le.sh" rm -f /bin/le rm -f /bin/le.sh