BradleyA / pi-display

Displays are Pimoroni Blinkt, Scroll-pHAT, and Scroll-pHAT-HD connected to Raspberry Pi 3 using Triple GPIO Multiplexing Expansion Board
MIT License
3 stars 0 forks source link

rotate log files #58

Closed BradleyA closed 5 years ago

BradleyA commented 5 years ago

log data filling disk space - logrotate for log files

https://www.cyberciti.biz/faq/how-do-i-rotate-log-files/
BradleyA commented 5 years ago

sudo vi /etc/logrotate.conf

# see "man logrotate" for details
# rotate log files weekly
#       weekly
daily

# use the syslog group by default, since this is the owning group
# of /var/log/syslog.
#       su root syslog
su root syslog uadmin

# keep 4 weeks worth of backlogs
#       rotate 4
rotate 32

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress
compress
. . . 
BradleyA commented 5 years ago

https://www.digitalocean.com/community/tutorials/how-to-manage-logfiles-with-logrotate-on-ubuntu-16-04

https://linuxhint.com/logrotate-ubuntu-tutorial/

BradleyA commented 5 years ago

move logrotate files (status, pi-display) into /usr/local/data/us-tx-cluster-1/logrotate

test with the following command, it works!!!

/usr/sbin/logrotate -s /usr/local/data/us-tx-cluster-1/logrotate/status /usr/local/data/us-tx-cluster-1/logrotate/pi-display

add line in crontab

BradleyA commented 5 years ago

mail log sudo apt install mailutils echo test | /usr/bin/mail -s 'incident report six-rpi3b.cptx86.com-crontab' allen.bradley@ymail.com /usr/bin/mail -s 'incident report six-rpi3b.cptx86.com-crontab' allen.bradley@ymail.com < incident did not work, black listed mail -s 'incident report six-rpi3b.cptx86.com-crontab' l0s5r0u1x1l9h3m1@cptx86.slack.com < incident

BradleyA commented 5 years ago
sudo ls

cd
sudo rm -rf /usr/local/data
cd /usr/local/bin ; rm create-host-info.sh create-display-message.sh cpu-temperature.sh   CPU_usage.sh display-led.py display-message-hd.py display-message.py display-led-test.py     display-scrollphathd-test.py display-scrollphat-test.py
sudo rm /var/spool/cron/crontabs/uadmin
cd ~/github/BradleyA/
rm -rf pi-display/
git clone https://github.com/BradleyA/pi-display
cd pi-display/

sudo ./setup-pi-display.sh us-tx-cluster-1 /usr/local/data uadmin uadmin allen.bradley@ymail.com

crontab -e
sudo view /var/spool/cron/crontabs/uadmin

cd /usr/local/data/us-tx-cluster-1/logrotate
/usr/sbin/logrotate -s /usr/local/data/us-tx-cluster-1/logrotate/status /usr/local/data/us-tx-cluster-1/logrotate/pi-display-logrotate
BradleyA commented 5 years ago
sudo ls

cd
cd ~/github/BradleyA/
git clone https://github.com/BradleyA/pi-display
cd pi-display/

sudo ./setup-pi-display.sh us-tx-cluster-1 /usr/local/data uadmin uadmin allen.bradley@ymail.com
cd
crontab -e

cd /usr/local/data/us-tx-cluster-1/logrotate