|author||Victor Lowther <firstname.lastname@example.org>||2008-03-11 17:28:03 -0500|
|committer||Victor Lowther <email@example.com>||2008-03-11 17:28:03 -0500|
Updated hooks documentation.
1 files changed, 32 insertions, 22 deletions
diff --git a/pm/HOWTO.hooks b/pm/HOWTO.hooks
index 0ce10de..4e6cebc 100644
@@ -39,25 +39,35 @@ For any given sleep/wakeup cycle, the hooks in sleep.d are run twice:
If your hook is a shell script that supports POSIX/SuS compatible syntax, you
-MAY source /usr/lib/pm-utils/functions, which will perform the following
-1: All settings present in the files located in /etc/pm/config.d/ will be
- available as environment variables.
-2: The following convenience functions will be made available:
- 1: try_lock
- 2: spin_lock
- 3: release_lock
- 4: get_power_status
- 5: modunload
- 6: modreload
- 7: stopservice
- 8: restartservice
- 9: savestate
- 10: restorestate
- To get an overview of what each of those functions does and the parameters
- they accept, read the fine source. Note that other functions may be
- present -- those functions are internal to the pm-utils package and MUST NOT
- be used by external hooks. In the future, those functions will not be
- available to third-party hooks.
+MAY source /usr/lib/pm-utils/functions, which will make the following
+convenience functions available:
+ try_lock expects a single parameter -- the name of the lock to
+ try to acquire. Exit code denotes success.
+ Wrapper around try_lock. Second parameter is the number of seconds
+ to wait for the lock before giving up. If no second parameter
+ is passed, this function will wait forever.
+ Release a previously acquired lock. First parameter is the name of the
+ Outputs our power source on stdout.
+ Unload a module. Exit code denotes success.
+ Reload all the modules unloaded by modunload.
+ Stop a service. First parameter is the name of the service to stop.
+ Restart a service. Service must have been stopped by stopservice.
+ Save state piped into this function on stdin. First parameter is the
+ name of the state being saved. If a second parameter is passed, this
+ function will use it instead of stdin.
+ Outputs state saved by savestate on stdout. The first parameter is the
+ name of the state to restore.
+ Prevent a hook from running. The exact name of the hook (including
+ numberic prefix) must be passed.