Custom Bash Script to run on file upload


#1

I am currently running Ghost 2.0 and I have a script that automatically syncs the ‘content/images’ folder to a remote storage server.

I wanted to have this script run whenever a file is uploaded. I’ve played around with /current
/core/server/adapters/storage/LocalStorageAdapter.js under the ‘save’ function but it’s not working.

Almost as fif Ghost is not using this particular folder for uploads.

How can I do this? without creating a custom storage adapter?


#2

Hey @tawandabrandon I’ve had success with other systems using inotify events to run tasks on file creation / update. Something like the incron tool might help you. There’s plenty of information online, a good article to get you started may be: https://www.cyberciti.biz/faq/linux-inotify-examples-to-replicate-directories/

This would mean you don’t need to change anything in Ghost’s code which would make future upgrades easier for you.

Hope this helps :slight_smile:


#3

Perfect, thanks!


#4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.