Bug 1003084 - Scripts in /etc/pm/sleep.d/ are run with different arguments than documentation says
Summary: Scripts in /etc/pm/sleep.d/ are run with different arguments than documentati...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: pm-utils
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-30 17:54 UTC by D. Wagner
Modified: 2013-09-04 03:24 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-04 03:24:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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!


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