Sponsored Content
Top Forums Shell Programming and Scripting Run script when computer resume from being sleep state Post 303023408 by drew77 on Saturday 15th of September 2018 04:21:20 PM
Old 09-15-2018
Thanks.

This may not be elegant, but it works.
Feedback appreciated.

Code:
echo "Coming back from sleep mode." >> /home/andy/bin/CPU_Fan_Info.txt
echo fake | sudo -S pm-suspend
/bin/bash /home/andy/bin/CPU_FAN_INFO.sh

I read somewhere that it is not necessary to ever turn off computer, but to use suspend.

Not sure I am comfortable with that.

What happens if a power outage occurs when it is suspended?

Last edited by drew77; 09-16-2018 at 11:10 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to run a script when your computer is idle

I am trying to run a script that I made when my computer is idle. How do I go about doing this. Thanks :) (4 Replies)
Discussion started by: rehansaeed
4 Replies

2. UNIX for Dummies Questions & Answers

how can I run something as root (modprobe, to be exact) every time computer starts.

I have the root password for my box, but I'm ignorant. So, every time I start my computer, I have to run this command /sbin/modprobe fuse as su, so that I can do other stuff (like mount remote directories locally using sshfs) I guess there's some file, like .bashrc, only it's applicable... (4 Replies)
Discussion started by: tphyahoo
4 Replies

3. What is on Your Mind?

Are companies viewing my resume? How do I track my resume visits?

Hi everybody, I am wondering if there is any tool or website out there which can track who is viewing my resume. It is very frustrating when you send your CV or Cover Letter and you receive no feedback from the company, you don't even know if they have checked it out. Thanks for your help (1 Reply)
Discussion started by: gearyipswich
1 Replies

4. Shell Programming and Scripting

Perl Script to resume download

Hi, i am looking for a perl script that can resume broken download images from a remote server. Can anyone help me on this. thanks, Vince (1 Reply)
Discussion started by: vin_eme
1 Replies

5. Shell Programming and Scripting

How to run a process when the computer is idle?

Hi there, I wrote a script that scans a folder for new files. I don't want to run it at specific times but only when the computer is NOT busy. I tried to use nice but it doesn't really work. I mean, even if my process has less priority, it still slows down the other processes. I did a test... (3 Replies)
Discussion started by: chebarbudo
3 Replies

6. Hardware

Cannot resume from suspend with new motherboardktop, does not resume properly

I would like to get pm-suspend (or any other suspend method) working for a small new desktop computer. It is based on a Zotac GF-8200 ITX motherboard and an AMD Athlon II X@ 240 CPU using ArchLinux x86_64. The pm-suspend script works, apparently putting the machine into suspend correctly... (0 Replies)
Discussion started by: lagagnon
0 Replies

7. BSD

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (0 Replies)
Discussion started by: naveeng
0 Replies

8. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (1 Reply)
Discussion started by: naveeng
1 Replies

9. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (6 Replies)
Discussion started by: naveeng
6 Replies

10. Windows & DOS: Issues & Discussions

How to run a Windows Setup on a Linux computer?

I am looking to run a Windows utility BitRecover PST Viewer. To help me read a pst file. Can anybody guide me how can I run this Windows utility on Linux. (3 Replies)
Discussion started by: marktux
3 Replies
SYSTEMD-SUSPEND.SERVICE(8)				      systemd-suspend.service					SYSTEMD-SUSPEND.SERVICE(8)

NAME
systemd-suspend.service, systemd-hibernate.service, systemd-hybrid-sleep.service, systemd-sleep - System sleep state logic SYNOPSIS
systemd-suspend.service systemd-hibernate.service systemd-hybrid-sleep.service /usr/lib/systemd/systemd-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. Immediately before entering system suspend and/or hibernation systemd-suspend.service (and the other mentioned units, respectively) will run all executables in /usr/lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be "pre", the second either "suspend", "hibernate", or "hybrid-sleep" 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 /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If applications want to be notified of system suspend/hibernation and resume, there are much nicer interfaces available. Note that systemd-suspend.service, systemd-hibernate.service, and systemd-hybrid-sleep.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. See systemd-sleep.conf(5). OPTIONS
systemd-sleep understands the following commands: -h, --help Print a short help text and exit. --version Print the systemd version identifier and exit. suspend, hibernate, hybrid-sleep Suspend, 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) systemd 208 SYSTEMD-SUSPEND.SERVICE(8)
All times are GMT -4. The time now is 10:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy