0

In Ubuntu 16.04, the scripts under /etc/pm/sleep.d and /usr/lib/pm-utils/sleep.d are run upon suspension/hibernation and resuming/thawing. If I create a script, can I place it under either directory? Is there some convention of what kinds of scripts goes to which directory? Thanks.

2

The “usual” conventions apply: anything under /usr, outside of /usr/local, belongs to the packages provided by the distribution; anything under /etc belongs to the system administrator (although packages can place defaults there too).

Thus in your case, your files should go into /etc/pm/sleep.d.

Quoting the Filesystem Hierarchy Standard (which Debian follows, as do Ubuntu and most other Linux distributions):

/usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere.

  • If you put something in /usr and it's in a distribution-supplied directory, expect that it may get clobbered on your next update! :-) (That's not really true: distributions are really careful about not touching stuff that's been altered, but it's good practice to keep your site modifications separated from the distribution. If you ever need to recover or upgrade/change your distribution, you'll be glad you did!) – ErikF Apr 3 '18 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.