diff --git a/1.0.0/42_addons/2_Cloud.md b/1.0.0/42_addons/2_Cloud.md index 5dd84fc..c0efc79 100644 --- a/1.0.0/42_addons/2_Cloud.md +++ b/1.0.0/42_addons/2_Cloud.md @@ -56,50 +56,4 @@ Copy and paste the configuration to the cloud.service Enable the service to start on boot - systemctl enable cloud.service - -## Reset disk and memory space - -The SD card of your Raspberry Pi, has limited space, therefore we need some process to clean up the images taken by the machinery. - - mkdir /home/bash - nano /home/bash/run.sh - -Copy paste the bash script - - #!/bin/bash - - ################################################################ - # Check if memory is more than 70%, if so refresh nodejs scripts - ## - if [[ $(free | grep Mem | awk -F' ' '{ print $3/$2*100 }' | echo $0 ) > 70.0 ]]; - then - /usr/bin/forever restartall ; - fi; - - ############################################################## - # Check if disk size is more than 95%, if so remove some files - # from the capture directory. - ## - if [[ $(df -h | grep /dev/root | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 95 ]]; - then - rm -f $( ls -d -1tr /home/kerberos-web/public/capture/* | head -n 500); - fi; - - ############################################# - # Only keep images of last 3 days on sd-card. - ## - find /home/kerberos-web/public/capture/ -type f -name '*.jpg' -mtime +1 -exec rm {} \; - -Give rights to bash script - - chmod +x /home/bash/run.sh - chmod 755 /home/bash/run.sh - -Start cronjob that will run this bash script - - crontab -e - -Add following line - - */10 * * * * /bin/sh /home/bash/run.sh \ No newline at end of file + systemctl enable cloud.service \ No newline at end of file diff --git a/1.0.0/5_FAQ.md b/1.0.0/5_FAQ.md index 6810dff..6db2943 100644 --- a/1.0.0/5_FAQ.md +++ b/1.0.0/5_FAQ.md @@ -8,6 +8,7 @@ The FAQ, Frequently Asked Questions, page contains **technical solutions** for c * [How to setup WIFI connection on Raspberry Pi](#setup-wifi) * [How to enable Raspberry Pi Camera Module](#how-to-enable-camera-module) * [Arch Linux](#how-to-enable-camera-module-archlinux) +* [Clean up disk and memory space](#clean-up-disk) ## How to expand SD card root partition @@ -226,4 +227,51 @@ To enable the camera module, you will need to add these lines to your /boot/conf gpu_mem=128 start_file=start_x.elf fixup_file=fixup_x.dat - disable_camera_led=1 \ No newline at end of file + disable_camera_led=1 + + +## Clean up disk and memory space + +The SD card of your Raspberry Pi, has limited space, therefore we need some process to clean up the images taken by the machinery. + + mkdir /home/bash + nano /home/bash/run.sh + +Copy paste the bash script + + #!/bin/bash + + ################################################################ + # Check if memory is more than 70%, if so refresh nodejs scripts + ## + if [[ $(free | grep Mem | awk -F' ' '{ print $3/$2*100 }' | echo $0 ) > 70.0 ]]; + then + /usr/bin/forever restartall ; + fi; + + ############################################################## + # Check if disk size is more than 95%, if so remove some files + # from the capture directory. + ## + if [[ $(df -h | grep /dev/root | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 95 ]]; + then + rm -f $( ls -d -1tr /home/kerberos-web/public/capture/* | head -n 500); + fi; + + ############################################# + # Only keep images of last 3 days on sd-card. + ## + find /home/kerberos-web/public/capture/ -type f -name '*.jpg' -mtime +1 -exec rm {} \; + +Give rights to bash script + + chmod +x /home/bash/run.sh + chmod 755 /home/bash/run.sh + +Start cronjob that will run this bash script + + crontab -e + +Add following line + + */10 * * * * /bin/sh /home/bash/run.sh \ No newline at end of file diff --git a/dev/42_addons/2_Cloud.md b/dev/42_addons/2_Cloud.md index 3c97d37..4a6c74d 100644 --- a/dev/42_addons/2_Cloud.md +++ b/dev/42_addons/2_Cloud.md @@ -56,50 +56,4 @@ Copy and paste the configuration to the cloud.service Enable the service to start on boot - systemctl enable cloud.service - -## Reset disk and memory space - -The SD card of your Raspberry Pi, has limited space, therefore we need some process to clean up the images taken by the machinery. - - mkdir /home/bash - nano /home/bash/run.sh - -Copy paste the bash script - - #!/bin/bash - - ################################################################ - # Check if memory is more than 70%, if so refresh nodejs scripts - ## - if [[ $(free | grep Mem | awk -F' ' '{ print $3/$2*100 }' | echo $0 ) > 70.0 ]]; - then - /usr/bin/forever restartall ; - fi; - - ############################################################## - # Check if disk size is more than 95%, if so remove some files - # from the capture directory. - ## - if [[ $(df -h | grep /dev/root | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 95 ]]; - then - rm -f $( ls -d -1tr /home/kerberos-web/public/capture/* | head -n 500); - fi; - - ############################################# - # Only keep images of last 3 days on sd-card. - ## - find /home/kerberos-web/public/capture/ -type f -name '*.jpg' -mtime +1 -exec rm {} \; - -Give rights to bash script - - chmod +x /home/bash/run.sh - chmod 755 /home/bash/run.sh - -Start cronjob that will run this bash script - - crontab -e - -Add following line - - */10 * * * * /bin/sh /home/bash/run.sh \ No newline at end of file + systemctl enable cloud.service \ No newline at end of file diff --git a/dev/5_FAQ.md b/dev/5_FAQ.md index 6810dff..6db2943 100644 --- a/dev/5_FAQ.md +++ b/dev/5_FAQ.md @@ -8,6 +8,7 @@ The FAQ, Frequently Asked Questions, page contains **technical solutions** for c * [How to setup WIFI connection on Raspberry Pi](#setup-wifi) * [How to enable Raspberry Pi Camera Module](#how-to-enable-camera-module) * [Arch Linux](#how-to-enable-camera-module-archlinux) +* [Clean up disk and memory space](#clean-up-disk) ## How to expand SD card root partition @@ -226,4 +227,51 @@ To enable the camera module, you will need to add these lines to your /boot/conf gpu_mem=128 start_file=start_x.elf fixup_file=fixup_x.dat - disable_camera_led=1 \ No newline at end of file + disable_camera_led=1 + + +## Clean up disk and memory space + +The SD card of your Raspberry Pi, has limited space, therefore we need some process to clean up the images taken by the machinery. + + mkdir /home/bash + nano /home/bash/run.sh + +Copy paste the bash script + + #!/bin/bash + + ################################################################ + # Check if memory is more than 70%, if so refresh nodejs scripts + ## + if [[ $(free | grep Mem | awk -F' ' '{ print $3/$2*100 }' | echo $0 ) > 70.0 ]]; + then + /usr/bin/forever restartall ; + fi; + + ############################################################## + # Check if disk size is more than 95%, if so remove some files + # from the capture directory. + ## + if [[ $(df -h | grep /dev/root | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 95 ]]; + then + rm -f $( ls -d -1tr /home/kerberos-web/public/capture/* | head -n 500); + fi; + + ############################################# + # Only keep images of last 3 days on sd-card. + ## + find /home/kerberos-web/public/capture/ -type f -name '*.jpg' -mtime +1 -exec rm {} \; + +Give rights to bash script + + chmod +x /home/bash/run.sh + chmod 755 /home/bash/run.sh + +Start cronjob that will run this bash script + + crontab -e + +Add following line + + */10 * * * * /bin/sh /home/bash/run.sh \ No newline at end of file