Red Hat Bugzilla – Bug 1003084
Scripts in /etc/pm/sleep.d/ are run with different arguments than documentation says
Last modified: 2013-09-03 23:24:47 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
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
# 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'.
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!