There is a lot of open source file sync software out there (ownCloud, NextCloud, Seafile, Syncthing, ...) that would be much better suited for a self-hosted Dropbox replacement than a single bash script. You are many orders of magnitude more likely to lose your data due to a code bug or unstable network than deplatforming. I looked into setting up something of the sort for myself a little while ago, but unfortunately…
NextCloud and ownCloud can be set up to utilize Amazon S3 or Wasabi storage. This works really well and is very inexpensive. Both my GFs business files and my personal/work files all are backed up Dropbox style for less then $10 a month including web and mobile access.
I found NextCloud a little buggy compared to OwnCloud but it has more features and unfortunately I'm stuck with it for the time being and can't easily switch back to NextCloud. The sync works fine though.