Skip to content

Commit

Permalink
remove sudo from crontab
Browse files Browse the repository at this point in the history
  • Loading branch information
neil committed Feb 19, 2016
1 parent 18d10a9 commit f9a1b64
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions le.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
VER=1.1.6
VER=1.1.7
PROJECT="https://github.com/Neilpang/le"

DEFAULT_CA="https://acme-v01.api.letsencrypt.org"
Expand Down Expand Up @@ -322,13 +322,6 @@ _stopserver() {

_initpath() {

#check if there is sudo installed, AND if the current user is a sudoer.
if command -v sudo > /dev/null ; then
if [ "$(sudo -n uptime 2>&1|grep "load"|wc -l)" != "0" ] ; then
SUDO=sudo
fi
fi

if [ -z "$LE_WORKING_DIR" ]; then
LE_WORKING_DIR=$HOME/.le
fi
Expand Down Expand Up @@ -1043,7 +1036,7 @@ installcronjob() {
_err "Can not install cronjob, le.sh not found."
return 1
fi
crontab -l | { cat; echo "0 0 * * * $SUDO LE_WORKING_DIR=\"$LE_WORKING_DIR\" $lesh cron > /dev/null"; } | crontab -
crontab -l | { cat; echo "0 0 * * * LE_WORKING_DIR=\"$LE_WORKING_DIR\" $lesh cron > /dev/null"; } | crontab -
fi
return 0
}
Expand Down Expand Up @@ -1138,7 +1131,14 @@ _initconf() {

install() {
_initpath


#check if there is sudo installed, AND if the current user is a sudoer.
if command -v sudo > /dev/null ; then
if [ "$(sudo -n uptime 2>&1|grep "load"|wc -l)" != "0" ] ; then
SUDO=sudo
fi
fi

if command -v yum > /dev/null ; then
YUM="1"
INSTALL="$SUDO yum install -y "
Expand Down

0 comments on commit f9a1b64

Please sign in to comment.