LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How Would I Create/Write This Script? (https://www.linuxquestions.org/questions/linux-software-2/how-would-i-create-write-this-script-4175521267/)

NotAComputerGuy 10-07-2014 02:07 AM

How Would I Create/Write This Script?
 
Hello, firstly a disclaimer, I'm not a computer guy, I don't really *get* computers and I certainly don't know best practice. That said, I do use OwnCloud and this is a slight problem I have with it.

I have an external hard drive that OwnCloud writes to, but it takes too long to 'spin up' so the first picture of many always fails to upload. What I was thinking of doing is plugging in a USB stick so that it's always available, but then having the system move the files from the USB stick to the hard drive and then linking the file so that owncloud thinks it's still there.

My owncloud is kept in /media/owncloud
My usb would be in /media/usb.owncloud

My biggest problem with this is have no idea what I'm doing. I think I would use cron to run the script at 0400 in the morning or something.

Thanks :)

Drakeo 10-07-2014 02:18 AM

read these it is simple stuff https://www.debian-administration.or...ling_with_cron

and this http://www.jveweb.net/en/archives/20...ith-rsync.html
that should handle your stuff.

NotAComputerGuy 10-07-2014 02:25 AM

Thanks for the reply. I'm not sure that rsync would be what I want, as the USB would probably run out of room pretty quickly. This was my thinking behind using a "link" ("ln" type of thing).

Drakeo 10-07-2014 07:08 AM

there is different types of rysnc the type that adds to the folder. and the type that copys to the folder and does not delete from the main folder. if your just adding stuff to a folder then do a cron that adds your uploads then delets the usb folder. any way you look at it your just moving stuff from one folder to another.
mv /usb.owncloud/*.png /external-drive.ownclowd/
or cd usb
Code:

ln -s owncloud  /path/to/eternal/drive/owncloudrepo


All times are GMT -5. The time now is 05:44 AM.