Skip to content

Commit

Permalink
Merge pull request #81 from tkisme/3.0
Browse files Browse the repository at this point in the history
logrotate and log to specific file
  • Loading branch information
Phus Lu committed Dec 25, 2014
2 parents 91f3b20 + 7981fe3 commit 98fce5e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion local/proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:${PATH}

start() {
echo -n "Starting ${PACKAGE_DESC}: "
nohup /usr/bin/env python2.7 proxy.py 2>&1 | grep --line-buffered -v "INFO -" | /usr/bin/logger -t ${PACKAGE_NAME} &
if [ ! -d /etc/logrotate.d ]; then
nohup /usr/bin/env python2.7 proxy.py 2>&1 | grep --line-buffered -v "INFO -" | /usr/bin/logger -t ${PACKAGE_NAME} &
else
if [ ! -f /etc/logrotate.d/goagent ]; then
cat > /etc/logrotate.d/goagent <<EOF
/var/log/goagent.log {
daily
rotate 7
compress
missingok
notifempty
nocreate
}
EOF
fi
nohup /usr/bin/env python2.7 proxy.py 2>&1 | grep --line-buffered -v "INFO -" >> /var/log/goagent.log &
fi
echo "${PACKAGE_NAME}."
}

Expand Down

0 comments on commit 98fce5e

Please sign in to comment.