As the title says, I need to monitor a remote folder for new files through a SFTP connection.
I setup a daemon process that opens a connection and if it finds any files then it retrieves their contents and if it doesn't then it sleeps for 5 seconds. This works fine it just hovers around 4% CPU usage. Is there a better way to do this and is it bad to keep a connection like this open indefinitely?