Bug 1003084

Summary: Scripts in /etc/pm/sleep.d/ are run with different arguments than documentation says
Product: [Fedora] Fedora Reporter: D. Wagner <daw-redhatbugzilla>
Component: pm-utilsAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: daw-redhatbugzilla, jskarvad, pknirsch, rhughes
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-04 03:24:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description D. Wagner 2013-08-30 17:54:37 UTC
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., 

/usr/share/doc/pm-utils-1.4.1/README:

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

/usr/share/doc/pm-utils-1.4.1/HOWTO.hooks:

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
pm-utils-1.4.1-24.fc19.x86_64

Comment 1 Jaroslav Škarvada 2013-09-03 09:54:45 UTC
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
suspend
resume

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-04 03:24:47 UTC
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!