Announcement

Collapse
No announcement yet.

Putting computer to sleep via shell

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Putting computer to sleep via shell

    I once was able to put my computer to sleep via a shell command, unfortunately I can't find it anymore. It was a pretty basic command where you specify the sleep time in minutes.

    I have tried looking again on the internet, and can't seem to find one now that works simply, every other one I have tried fails to work.

    Can someone help me out here please?


    #2
    Perhaps this is of any help?

    https://www.cyberciti.biz/faq/linux-...op-netbook-pc/
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    Comment


      #3
      Thanks I am sure it will, however, I am wondering if my issues are now stemming from the fact that I may have disabled the sleep option (in the system settings or somewhere). I recall I did something as at the time I didn't want me machine to go into sleep while it was performing a task,

      because now when I click on the start menu I don't have a sleep option which should be there?

      Click image for larger version

Name:	image.png
Views:	134
Size:	14.0 KB
ID:	668180

      I have looked under power management in the system settings, but can't find anything obvious in there

      Comment


        #4
        What do
        Code:
        sudo systemctl status sleep.target
        sudo systemctl status suspend.target
        sudo systemctl status suspend-then-hibernate.target
        sudo systemctl status hibernate.target
        show?

        Did you change anything in /usr/share/kubuntu-default-settings/kf5-settings/kdeglobals or in another kdeglobals file?
        Last edited by Schwarzer Kater; Jan 30, 2023, 02:00 AM.
        Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
        Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

        get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
        install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

        Comment


          #5
          This is what I get returned and similar for the rest of those commands

          sleep.target

          Loaded: masked (Reason: Unit sleep.target is masked.)
          Active: inactive (dead)



          I did a ll on the file below and it looks like it hasn't been touched recently, I don't recall editing any global files
          /usr/share/kubuntu-default-settings/kf5-settings/kdeglobals

          Comment


            #6
            Then try a sudo systemctl unmask on the targets you need (personally I don't use hibernate on any computer with an SSD as this writes the whole memory to disk and reduces the lifetime of the SSD -> hibernate = "suspend to disk").

            I think you need to reboot or at least log out and log in again after this.
            Last edited by Schwarzer Kater; Jan 30, 2023, 01:36 PM.
            Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
            Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

            get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
            install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

            Comment


              #7
              that was it thank you! I see the sleep option now showing in the start menu. Will try some examples in the link you originally posted

              Comment

              Working...
              X