Bug 1003084 - Scripts in /etc/pm/sleep.d/ are run with different arguments than documentation says
Scripts in /etc/pm/sleep.d/ are run with different arguments than documentati...
Product: Fedora
Classification: Fedora
Component: pm-utils (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jaroslav Škarvada
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-08-30 13:54 EDT by D. Wagner
Modified: 2013-09-03 23:24 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-03 23:24:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description D. Wagner 2013-08-30 13:54:37 EDT
Description of problem:

I created a shell script in /etc/pm/sleep.d/.  I expect it to be run every time my machine wakes up from sleep with the argument 'resume', but it actually is invoked with 'post'.

The pm-utils documentation says it will be called with 'resume'.  e.g., 


  5) Each of /etc/pm/sleep.d/* are executed in reverse C sort order,
     with a command line argument of "resume" or "thaw".


For hooks in sleep.d, the potential values of the first parameter are:
resume -- The hook MUST perform whatever action is appropriate when the 
        system is coming out of suspend.

A web-search also shows many web pages that tell me to expect the argument to be 'resume', not 'post'.  However, some logging statements show me that it is actually being called with the argument 'post'.

It looks like /etc/pm/sleep.d/ scripts are getting called with the arguments that would be expected for systemd scripts in /usr/lib/systemd/system-sleep/, rather than the proper arguments for /etc/pm/sleep.d/.

# rpm -q pm-utils
Comment 1 Jaroslav Škarvada 2013-09-03 05:54:45 EDT
I am unable to reproduce, f19 with latest updates, pm-utils-1.4.1-24.fc19.x86_64, reproducer:

# echo -e '#/bin/bash\n\necho $1 >> /var/tmp/log' > /etc/pm/sleep.d/test
# chmod a+rx /etc/pm/sleep.d/test
# pm-suspend
# cat /var/tmp/log

The pm-utils are deprecated in f19, the same procedure now with systemd:
# echo -n > /var/tmp/log
# systemctl suspend
# cat /var/tmp/log
Nothing as expected.

Are you using pm-suspend or 'systemctl suspend'? If the latter, there is probably some symlink in the /usr/lib/systemd/system-sleep/ directory. If the former try 'rpm -qV pm-utils'.
Comment 2 D. Wagner 2013-09-03 23:24:47 EDT
Gosh, you are absolutely right.  I must have made some mistake in my debugging.  I apologize profusely for taking up your time on the invalid bug report.  My mistake.  Thank you so much for your time and your help!

Note You need to log in before you can comment on or make changes to this bug.