Skip to content

Commit

Permalink
Apply PR #42 - upgrade PR #23 (rename file for deletion)
Browse files Browse the repository at this point in the history
  • Loading branch information
fritz-smh committed Jun 8, 2016
1 parent a01f61f commit 27e3fa9
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 23 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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.
43 changes: 37 additions & 6 deletions sd/test/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
==========

This script will cleanup video files older than 15 days.

You need to add it in the crontab
delete_old_videos.sh
====================

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
```
14 changes: 0 additions & 14 deletions sd/test/scripts/cleanup.sh

This file was deleted.

14 changes: 14 additions & 0 deletions sd/test/scripts/delete_old_videos.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion sd/test/yi-hack.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 27e3fa9

Please sign in to comment.