Thursday 20 April 2017

How to run function once a month? - Javascript

I want to have a function running 24/7, and once a month, at the same time each month, it will run function2. Now, i also need to output a file to log the current time if the server disconnects, then on reconnect it will read the file, and continue from there. To allow the server to reboot and not mess up the schedule. I don't care about specific seconds or even hours. As long as it runs the function2 every 30 days it will work fine. I have a database that stores:

Image{
    name: 'sunglasses.png',
    url: 'site.com/sdfhj2of2',
    path: 'uploads/images/sdfsfwf2',
    uploadDate: '05-12-16',
    expireDate: '6-12-16'
}

Now, I have to figure out how to handle deleting this file, 30 days after it is uploaded. How can/should I do this? The deleting from database/directory I can handel, but how to call that function when the image reaches it expire date idk.



via Josh Beyer

No comments:

Post a Comment