1
0
mirror of https://github.com/fritz-smh/yi-hack synced 2025-06-07 16:06:11 +00:00

Apply PR #42 - upgrade PR #23 (rename file for deletion)

This commit is contained in:
fritz-smh 2016-06-08 22:07:05 +02:00
parent a01f61f432
commit 27e3fa9dfc
5 changed files with 60 additions and 22 deletions

View File

@ -132,7 +132,7 @@ The telnet server is on port 23.
Default login/password :
* login = root
* password = 1234qwer
* password = 1234qwer (unless you specified another password in yi-hack.cfg file)
Ftp server
----------
@ -178,4 +178,6 @@ equip_test.sh
check_motion.sh
---------------
**TODO**
Script that runs from equip_test.sh and tell us if a new video was created in the last minute (a video file is created in case of motion detection).
If a file is found, it adds the name of the file to the section GET /motion on the http server.

View File

@ -18,9 +18,40 @@ Source of the script :
* https://github.com/fritz-smh/yi-hack/pull/24
* http://4pda.ru/forum/index.php?showtopic=638230&st=2780#entry44208114
cleanup.sh
==========
delete_old_videos.sh
====================
This script will cleanup video files older than 15 days.
You need to add it in the crontab
This script searchs and deletes videos older than 15 days. (You can change this value if you configure the script)
You have to run it manually or add it to crontab for running it autmatically.
The camera might throw an error if you try to run "crontab -e":
```sh
crontab -e
crontab: chdir(/var/spool/cron/crontabs): No such file or directory
```
If that's the case just create that dir manually and you can edit the crontab with "crontab -e"
Example configuration of crontab (runs the script the 15th of each month):
```sh
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
0 0 15 * * /home/hd1/test/scripts/delete_old_videos.sh
```

View File

@ -1,14 +0,0 @@
#!/bin/sh
#Delete files and folders more than 15 days
dir="/home/hd1/record/"
days=+15
dt=`date +%y%m%d`
#echo $dir
#echo $days
#echo $dt
#Command:
du -sh ${dir} > ${dir}Delete_$dt.log
find ${dir} -mtime $days -exec rm -Rf {} \;
du -sh ${dir} >> ${dir}Delete_$dt.log
echo "Works!"

View File

@ -0,0 +1,14 @@
#!/bin/sh
#Delete files and folders more than 15 days
#To run this script you can make an entry the cameras crontab
#You might need to create manually the folder structure /var/spool/cron/crontabs
#or when you try to add a crontab with "crontab -e" it might give you an error
#search on internet about the use of crontab
dir="/home/hd1/record/"
days=+15
dt=`date +%y%m%d`
du -sh ${dir} > ${dir}Delete_$dt.log
find ${dir} -mtime $days -exec rm -Rf {} \;
du -sh ${dir} >> ${dir}Delete_$dt.log

View File

@ -24,9 +24,14 @@ GATEWAY=192.168.1.254
LED_WHEN_READY=-boff -bon
### Timezone
TIMEZONE=GMT-2
# Example timezones, see more at http://svn.fonosfera.org/fon-ng/trunk/luci/modules/admin-fon/root/etc/timezones.db
# -Europe/London GMT0BST,M3.5.0/1,M10.5.0
# -Europe/Paris CET-1CEST,M3.5.0,M10.5.0/3
# -US/Central CST6CDT,M3.2.0,M11.1.0
TIMEZONE=GMT0BST,M3.5.0/1,M10.5.0
### NTP server
#If you want to change your ntp server you can see a list here http://www.pool.ntp.org/zone/@
NTP_SERVER=0.uk.pool.ntp.org
### Debug