Skip to content
Advertisement

Tag: notifications

How can my Linux program get a computer-is-about-to-go-to-sleep notification, without modifying any system config files?

I wrote a Linux program that creates some persistent TCP connections, and I would like my program to close() those TCP sockets just before the Linux-computer goes to sleep, so that the remote peer isn’t left with a non-responsive “zombie” TCP connection. According to this answer, one way to do that is to modify the /etc/pm/sleep.d file to run a

Linux folder change auto notification

Is there a way that I can programmatically figure out whether a particular file with certain characteristics is being added into say the linux /tmp folder. All I need to create, is a small script that is automatically called every time a new file is added in the tmp folder. Answer These links might be helpful: Inotify and Inotify-tools.

Advertisement