Skip to content

Commit

Permalink
Add -E for all sudo invocations (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
vin01 authored Jul 1, 2022
1 parent 13b81bd commit eb97e3e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bin/opencanaryd
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ elif [ "${cmd}" == "--usermodule" ]; then
sudo -E "${DIR}/twistd" -noy "${DIR}/opencanary.tac"

elif [ "${cmd}" == "--restart" ]; then
pid=`sudo cat "${PIDFILE}"`
sudo kill "$pid"
pid=`sudo -E cat "${PIDFILE}"`
sudo -E kill "$pid"
sudo -E "${DIR}/twistd" -y "${DIR}/opencanary.tac" --pidfile "${PIDFILE}" --syslog --prefix=opencanaryd
elif [ "${cmd}" == "--stop" ]; then
pid=`sudo cat "${PIDFILE}"`
sudo kill "$pid"
pid=`sudo -E cat "${PIDFILE}"`
sudo -E kill "$pid"
elif [ "${cmd}" == "--copyconfig" ]; then
if [ -f /etc/opencanaryd/opencanary.conf ]; then
echo "A config file already exists at /etc/opencanaryd/opencanary.conf, please move it first"
Expand All @@ -62,8 +62,8 @@ elif [ "${cmd}" == "--copyconfig" ]; then
else
defaultconf=$(python3 -c "from pkg_resources import resource_filename; print(resource_filename('opencanary', 'data/settings.json'))")
fi
sudo mkdir -p /etc/opencanaryd
sudo cp "${defaultconf}" /etc/opencanaryd/opencanary.conf
sudo -E mkdir -p /etc/opencanaryd
sudo -E cp "${defaultconf}" /etc/opencanaryd/opencanary.conf
echo -e "[*] A sample config file is ready /etc/opencanaryd/opencanary.conf\n"
echo "[*] Edit your configuration, then launch with \"opencanaryd --start\""
elif [ "${cmd}" == "--version" ]; then
Expand Down

0 comments on commit eb97e3e

Please sign in to comment.