I have a C3 application that will be hosted as a webapp. I need to clean up files that accumulate in the /assets/uploads/ directory. I do have a logout button and I can go through the mysql table that holds the filenames and clean up when a user logsout. But how about when a user just presses the 'X' in the tab? Is there anyway I can force a function to run at that time?
From my limited understanding of how CI works in a multiuser app, all users are sharing that same
/assets/uploads/ directory. So I can't just obliterate that directory. Right?
I have actually come up with a simpler solution. Seems that AWS CLI supports:
aws s3 sync s3://example-bucket .
aws s3 sync . s3://example-bucket
Which will synch a certain dir up to and back from S3 to the server. To run this I will need to cd to the directory I want to synch, and then will want to run this is in a non-blocking shell. In the article Wainstein talks about using cron but I am concerned about that delaying updating the servers.
Is it possible to run a cron job on demand (for example, when a new user logs in?).
proof that an old dog can learn new tricks