Is it possible if someone can tell me how to automatically prune the Glitch disk? I already know how to make things automatically run with cron jobs, I need help with disk pruning code though. Thank you.
Oops, wrong tag. Apologies.
Apologies, however, wrong request.
Is there a way to make a code to automatically remove all tmp folder files?
Oh, yes, Modify your package.json/glitch.json file to look like this: rm -r /tmp && [Command]
Is that to insert in the code? I am not talking about the console, apologies. Trying to embed something like this to my cron job code.
Thank you, will try!
Didn’t work - is it possible if you could tell me how to do it in server.js?
Sure!
var cron = require('node-cron');
var shell = require('shelljs');
cron.schedule('* * * * *', () => { // Make cron jobs here at crontab.guru
shell.rm('-v', '/tmp/*');
});
Make sure to have node-cron and shelljs is installed!
Thank you!
Actually you don’t need any 3rd party packages:
Couldn’t you just setup a cronjob?
He could and said that he knew how to but wanted to do it programmatically which I do most of the time as well.
Yeah, but shelljs makes it easier!
That is what is being done with node-cron
.