Re: Power Management, SystemD, etc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/27/2014 02:54 PM, V.99 wrote:
> On 19.5.2014 12:15, Trever L. Adams wrote:
>> The problem I am having is figuring out how to set it up so it
>> automatically goes to sleep after X period of time and stay asleep.
>>
> Hi Trever.
>
> I played with systemd a bit and made a script you can be inspired with
> (I hope).
>
> Create a script /usr/lib/systemd/system-sleep/autosleep.sh and make it
> runnable:
> -----------------------------------------------------
> #!/bin/bash
>
> # See:
> http://www.freedesktop.org/software/systemd/man/systemd-hibernate.service.html
>
> PHASE="$1"
> TYPE="$2"
> sleep 30
>
> echo "$(/bin/date +%Y%m%d-%H%M%S) P=$PHASE, T=$TYPE"
> >>/var/log/autosleep.log
>
> if [ "$PHASE" == "post" -a -f /autosleep ] ; then
>     RUNTIME=
>     . /autosleep
>     if [ "$RUNTIME" -gt 0 ] ; then
>         case "$TYPE" in
>         suspend|hibernate|hybrid-sleep)
>             echo '/sbin/pm-suspend-hybrid' | at now + $RUNTIME minutes
>             echo "$(/bin/date +%Y%m%d-%H%M%S) autosleep in $RUNTIME
> minutes" >>/var/log/autosleep.log
>             ;;
>         *)    ;;
>         esac
>     fi
> fi
> -----------------------------------------------------
> Then create a control file /autosleep:
> -----------------------------------------------------
> RUNTIME=10
> -----------------------------------------------------
> Replace number 10 with value you like, time is in minutes.
>
> To start autosleep just sleep system manually. Next sleeps occurs
> automatically.
> To stop autosleep first delete scheduled task by /bin/at -d and then
> remove /autosleep file.
>
> It seems hooks in /etc/pm/sleep.d doesn't work with systemd.
Thank you. I believe I can make work with this for making mine systemd,
right now it is cron. I use rtcwake instead of sleep. As I need it to
wake up for specific timed events (backups, that is what the machine
does). I also have it set to wake-on-lan so that I can do restores if
needed.

The problem I need to figure out is how to have it sleep when the system
is idle. I have others that this would work well for, if I could do
that. Gnome, etc. does this. I haven't found a command line/systemd
setup that will do this.

Say 10 minutes of being idle.

Thank you for your help!

Again, I now see clearly some systemd things I didn't before.

Trever

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux