YORIK’S COFFEE CORNER

You are currently viewing a single post of this guestblog.

Click here to go back the complete page. I would be glad to hear your comments, so don’t hesitate to leave me your feedback below. It will appear on the main guestblog page.


in categories  linux  permalink:  216   posted on 21.02.2013 22:15
From Yorik

Dropbox check script


If you are using dropbox on linux, be aware that there are several reports of dropbox "loosing" some of your files (the file still exists, but it has 0Kb size). The causes of this problem seem not very clear...

Anyway, I made this little script that checks your dropbox folder if everything is okay:

#!/bin/sh
if [ -z "$1" ]
then
    find /home/yorik/Dropbox/* -size 0 -type f
else
    if [ -n "$(find /home/yorik/Dropbox/* -size 0 -type f)" ]
    then
        notify-send -i important "Dropbox Warning" "0-byte files found"
        play /home/yorik/.sound/nuclear-alarm.wav
    fi
fi

To use it, just put the above text in a new file, adjust the paths /home/yorik/ to yours, save it and make it executable. If you run it without options, it will prin a list of 0-byte files found in your dropbox folder. If you run it with any kind of argument (for example checkdropbox -n), it will show an alert on your desktop if any 0-byte file is found. I use it that way in a cron job that runs every hour, that I set by adding the following line in crontab (do crontab -e in a terminal):

0 *  * * * env DISPLAY=:0 /home/yorik/bin/checkdropbox -n

the "env DISPLAY=:0" is needed when you want to lauch graphical applications from crontab...


First and foremost, your name:

And your message:

To publish it, just press this ...