Skip to content
Snippets Groups Projects
Commit 814bd711 authored by Bob Mottram's avatar Bob Mottram
Browse files

logging command

parent 7238d90a
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@ install:
install -m 755 src/${APP}-meshweb ${DESTDIR}${PREFIX}/bin/meshweb
install -m 755 src/${APP}-controlpanel ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-controlpanel ${DESTDIR}${PREFIX}/bin/control
install -m 755 src/${APP}-logging ${DESTDIR}${PREFIX}/bin
mkdir -m 755 -p ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-keydrive.1.gz ${DESTDIR}${PREFIX}/share/man/man1
......@@ -66,6 +67,7 @@ install:
install -m 644 man/${APP}-xmpp-pass.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-mesh.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-controlpanel.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-logging.1.gz ${DESTDIR}${PREFIX}/share/man/man1
uninstall:
rm -f ${PREFIX}/share/man/man1/${APP}.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-keydrive.1.gz
......@@ -92,6 +94,7 @@ uninstall:
rm -f ${PREFIX}/share/man/man1/${APP}-xmpp-pass.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-mesh.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-controlpanel.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-logging.1.gz
rm -rf ${PREFIX}/share/${APP}
rm -f ${PREFIX}/bin/${APP}
rm -f ${PREFIX}/bin/zeronetavahi
......@@ -121,6 +124,7 @@ uninstall:
rm -f ${PREFIX}/bin/${APP}-meshweb
rm -f ${PREFIX}/bin/meshweb
rm -f ${PREFIX}/bin/${APP}-controlpanel
rm -f ${PREFIX}/bin/${APP}-logging
clean:
rm -f \#* \.#* debian/*.substvars debian/*.log
rm -fr deb.* debian/${APP}
......
File added
......@@ -313,6 +313,10 @@ function restore_data_remote {
any_key
}
function logging_on_off {
and_key
}
function restore_gpg_key {
select_user
if [ ! $SELECTED_USERNAME ]; then
......@@ -331,7 +335,7 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Control Panel" \
--title "Control Panel" \
--radiolist "Choose an operation:" 22 70 15 \
--radiolist "Choose an operation:" 24 70 15 \
1 "Backup data to USB drive" off \
2 "Restore data from USB drive" off \
3 "Restore from remote backup" off \
......@@ -346,7 +350,8 @@ function menu_top_level {
12 "Backup GPG key to USB drive (master keydrive)" off \
13 "Backup GPG key to USB drive (fragment keydrive)" off \
14 "Restore GPG key from USB drive" off \
15 "Exit" on 2> $data
15 "Turn logging on/off" off \
16 "Exit" on 2> $data
sel=$?
case $sel in
1) exit 1;;
......@@ -367,7 +372,8 @@ function menu_top_level {
12) create_keydrive_master;;
13) create_keydrive_fragment;;
14) restore_gpg_key;;
15) break;;
15) logging_on_off;;
16) break;;
esac
done
}
......
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# Turn logging on or off
# License
# =======
#
# Copyright (C) 2015 Bob Mottram <bob@robotics.uk.to>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ ! "$1" ]; then
exit 1
fi
if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
if [ -d /etc/nginx ]; then
for filename in /etc/nginx/sites-available/* ; do
filename_domain=$(echo "$filename" | awk -F '/' '{print $5}')
sed -i 's|access_log.*|access_log /var/log/nginx/$filename_domain.access.log;|g' $filename
sed -i 's|warn_log.*|warn_log /var/log/nginx/$filename_domain.warn.log;|g' $filename
sed -i "s|error_log.*|error_log /var/log/nginx/$filename_domain.err.log;|g" $filename
done
fi
if [ -f /etc/init.d/spamassassin ]; then
sed -i 's|DOPTIONS="-s null -d --pidfile=$PIDFILE"|DOPTIONS="-d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
fi
if [ -d /etc/prosody ]; then
sed -i 's|info = "/dev/null";|info = "/var/log/prosody/prosody.log";|g' /etc/prosofy/prosody.cfg.lua
sed -i 's|error = "/dev/null";|error = "/var/log/prosody/prosody.err";|g' /etc/prosofy/prosody.cfg.lua
fi
else
if [ -d /etc/nginx ]; then
for filename in /etc/nginx/sites-available/* ; do
sed -i 's|access_log.*|access_log off;|g' $filename
sed -i 's|warn_log.*|warn_log off;|g' $filename
sed -i 's|error_log.*|error_log off;|g' $filename
done
fi
if [ -f /etc/init.d/spamassassin ]; then
sed -i 's|DOPTIONS="-d --pidfile=$PIDFILE"|DOPTIONS="-s null -d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
fi
if [ -d /etc/prosody ]; then
sed -i 's|info = "/var/log/prosody/prosody.log";|info = "/dev/null";|g' /etc/prosofy/prosody.cfg.lua
sed -i 's|error = "/var/log/prosody/prosody.err";|error = "/dev/null";|g' /etc/prosofy/prosody.cfg.lua
fi
fi
if [ -d /etc/nginx ]; then
service php5-fpm restart
service nginx restart
fi
if [ -f /etc/init.d/spamassassin ]; then
service spamassassin restart
fi
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment