Sponsored Content
Operating Systems Linux Red Hat How to run script after hibernation .. Post 302518611 by susja on Saturday 30th of April 2011 03:09:23 PM
Old 04-30-2011
Quote:
Originally Posted by verdepollo
Try putting your script in sleep.d.

This is the entry from my system (RHEL 5):

Code:
[verdepollo@atlas]~% cat /etc/pm/sleep.d/99sleep-script
#!/bin/sh
case "$1" in
   suspend|freeze)
	echo "Sleeping..."
   ;;

   resume|thaw)
	echo "*Yawn*"
   ;;

   *)
   ;;
esac


hi verdepollo,
thanks for reply,
first I just put my Perl script into /etc/pm/sleep.d but after that system failed to get into hibernation state. Then I placed my Perl script inside your script like this:

Code:
#!/bin/sh
case "$1" in
   suspend|freeze)
	echo "Sleeping..."
   ;;

   resume|thaw)
#	echo "*Yawn*"
	/usr/bin/perl /home/evoldman/Scripts/BSO.pl
   ;;

   *)
   ;;
esac

and it started to work. Well I put inside rc.local my perl script and it worked just fine after reboot but here it looks it doesn't like it.
In any case now I think I covered 2 cases: 1. when it boots up it runs rc.local and 2. when it wakes up from hibernation it executes your script.
Thanks a lot for your help.

Last edited by pludi; 05-01-2011 at 09:33 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

script to run different shells which run different processes

Hi, Would like to ask the experts if anyone knows how to run a script like this: dtterm -title shell1 run process1 on shell1 dtterm -title shell2 run process2 on shell2 cheers! p/s: sorry if i used the wrong forum, quite concussed after watching world cup for several nights; but I... (2 Replies)
Discussion started by: mochi
2 Replies

2. Ubuntu

Ubuntu 9.04 hibernation

Hello everyone, I finally installed Ubuntu 9.04 64 bit using dual boot. Love it! :b: Now I have an issue with the hibernation, it just turns off the monitor instead of the whole system when I click. Is there some else I have to get done? please advice, Many thanks. (2 Replies)
Discussion started by: Pitroadrush
2 Replies

3. Red Hat

Can't find Hibernation in Rhel5

I've installed Rhel 5.1 in an intel quad core server. I couldn't find the Hibernation option. And can't find anything related to it in the power management options. Plz guide how to install hibernation or enable thise option. Thanks, Giri (1 Reply)
Discussion started by: giri_blr
1 Replies

4. Ubuntu

Losing wmx0 interface after waking up from hibernation

I don't know why, but I can't connect to my WiMax network after waking up from hibernation... System log shows the following messages: Feb 5 10:07:52 lenovo-S102 wimaxd: wimaxd event: libwimax: 6843 Feb 5 10:07:52 lenovo-S102 wimaxd: wimaxd event: E: RX: cannot join multicast group 0: -22... (4 Replies)
Discussion started by: Sapfeer
4 Replies

5. AIX

My script didn't run every run every minute at cronjob

In my cronjob, I would like to schedule my script.sh to run every minutes. I crontab -e and have in line below but it didn't seems to run at all. * * * * * script.sh When I run it manually, I can run it. Is that anything wrong with the above line? If I change it to something like below,... (4 Replies)
Discussion started by: ngaisteve1
4 Replies

6. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

7. Linux

Systemd hibernation is killing me

I'm on Arch and I have a strange issue with systemctl hibernate command. It hibernates and resumes just fine (I have TuxOnIce), but in the last stage of resume, it completely shuts down my laptop screen, so I cannot see anything even though I know the system resumed just fined and the desktop is... (1 Reply)
Discussion started by: lockheed
1 Replies

8. Shell Programming and Scripting

Script fails to run properly when run from CRONTAB

Hello all, I'm trying to write a script to gather and send data and it works just fine at the bash command line, but when executing from CRON, it does not run properly. My scripting skills are pretty limited and there's probably a better way, but as I said it works at the command line, but... (12 Replies)
Discussion started by: rusman
12 Replies

9. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
SYSTEMD-SUSPEND.SERVICE(8)				      systemd-suspend.service					SYSTEMD-SUSPEND.SERVICE(8)

NAME
systemd-suspend.service, systemd-hibernate.service, systemd-hybrid-sleep.service, systemd-suspend-then-hibernate.service, systemd-sleep - System sleep state logic SYNOPSIS
systemd-suspend.service systemd-hibernate.service systemd-hybrid-sleep.service systemd-suspend-then-hibernate.service /lib/systemd/system-sleep DESCRIPTION
systemd-suspend.service is a system service that is pulled in by suspend.target and is responsible for the actual system suspend. Similarly, systemd-hibernate.service is pulled in by hibernate.target to execute the actual hibernation. Finally, systemd-hybrid-sleep.service is pulled in by hybrid-sleep.target to execute hybrid hibernation with system suspend and pulled in by suspend-then-hibernate.target to execute system suspend with a timeout that will activate hibernate later. Immediately before entering system suspend and/or hibernation systemd-suspend.service (and the other mentioned units, respectively) will run all executables in /lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be "pre", the second either "suspend", "hibernate", "hybrid-sleep", or "suspend-then-hibernate" depending on the chosen action. Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now "post". All executables in this directory are executed in parallel, and execution of the action is not continued until all executables have finished. Note that scripts or binaries dropped in /lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If applications want to react to system suspend/hibernation and resume, they should rather use the Inhibitor interface[1]. Note that systemd-suspend.service, systemd-hibernate.service, and systemd-hybrid-sleep.service systemd-suspend-then-hibernate.service should never be executed directly. Instead, trigger system sleep states with a command such as "systemctl suspend" or similar. Internally, this service will echo a string like "mem" into /sys/power/state, to trigger the actual system suspend. What exactly is written where can be configured in the "[Sleep]" section of /etc/systemd/sleep.conf or a sleep.conf.d file. See systemd-sleep.conf(5). OPTIONS
systemd-sleep understands the following commands: -h, --help Print a short help text and exit. --version Print a short version string and exit. suspend, hibernate, hybrid-sleep, suspend-then-hibernate Suspend, hibernate, suspend then hibernate, or put the system to hybrid sleep. SEE ALSO
systemd-sleep.conf(5), systemd(1), systemctl(1), systemd.special(7), systemd-halt.service(8) NOTES
1. Inhibitor interface https://www.freedesktop.org/wiki/Software/systemd/inhibit systemd 237 SYSTEMD-SUSPEND.SERVICE(8)
All times are GMT -4. The time now is 06:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy