Posts tagged ‘Linux’

Enigma2 OpenEmbedded Enhanced Movie Center Trashfolder CleanUp

We own a great VuPlus Solo2 Linux based Satelit Receiver. We record some series and films and then delete them. The deleted media files are not deleted directly when using EMC to view and delete. The media files are moved to a trash folder first and should be automatically deleted after x days. But that does not work for whatever reason.

Recently I checked the trash folders I found, as I wondered why the box’s hard disk is getting filled up. And I found many, many old ‘deleted’ files, that are not removed from the hard disk.

I decided to write my own script (/home/root/deltrasholder7days.sh, yes, there is a typo ;-)) ) to finally remove ‘deleted’ files after 7 days. The script was then added to the root’s crontab.

#!/bin/sh
# delete old files
# delete trash files older than 7 days
/usr/bin/find /mnt/hdd/movie_trash -type f -mtime +7 -delete
/usr/bin/find /mnt/hdd/movie/trashcan -type f -mtime +7 -delete
cd /mnt/hdd/movie_trash/
rm last_cleanup*
touch last_cleanup_$( date '+%Y-%m-%d_%H-%M-%S' )
cd /mnt/hdd/movie/trashcan/
rm last_cleanup*
touch last_cleanup_$( date '+%Y-%m-%d_%H-%M-%S' )

The script deletes all files at /mnt/hdd/movie_trash and /mnt/hdd/movie/trashcan with a modification date of 7 days before current day. Then it adds a file with a timestamp as name to let me know, that the script has worked at what time.
… and the crontab (/etc/cron/crontabs/root):

1 1 * * * /home/root/deltrasholder7days.sh

This starts the script every day at 1pm.

That’s all, thank’s to the author of the find utility.

FHEM logrotate

Hier möchte ich nur kurz meine logrotate configuration festhalten:

hgode@atom2:~$ cat /etc/logrotate.d/fhem 
/opt/fhem/log/fhem.log {
    missingok
    weekly
    copytruncate
    rotate 5
    compress
    postrotate
       /etc/init.d/fhem restart
    endscript
}

Wichtig ist, dass die Anweisung in postrotate/endscript keinen Fehler zurückmlden. Dann läuft das logrotate nämlich gar nicht!

TP-Link TD-W8961ND DSL router can not access admin web page after 24 hours or so

This is a security feature. If the Admin web page has not been accessed for some time the router disables the access completely. Router does still work, ping is OK, WLAN and WWAN connections are working, you just can not access the admin web page.

As I am running a Linux server I decided to make a hourly cron job that simply accesses the router admion web page every hour. So I can access the admin web all time without the need to cycle it’s power 🙁

I added a cron.hourly bash script to access the admin page every hour:

#!/bin/sh
wget -O - -q -t 1 --user=<adminusername> --password=<yourpassword> http://<yourrouterip>

Replace the user name, password entry and ip with the ones of your router and copy that bash shell script to /etc/cron.hourly. Don’t forget to make it executable (chmod a+x ).

Update: although the above is running the web admin page could not be reached after some days. Odd security mechanism 🙁

Howto dump all texts of a web site

Recently I wanted to get all texts from a web site to prepare a translation. Although I found the one or other tip, here is the easy solution with a linux system.
Simply use lynx:

lynx -crawl -traversal http://website.de

(just replace website.de with the URL you want to get the texts from).

To get all html pages (no images etc) you can use wget:
wget -r -k -L -A htm,html http://website.de

With lynx you will get all texts as dat files and can start reading/translating offline.