I am looking for a laptop auto shutdown or suspend to ram software.
I have one super good in windows. i wonder if there is one that is as good in linux.
I saw this software “sentinella” is as good…
It can trigger shutdown or suspend via cpu, via network tranfer rate via time via another package condition… but i can’t find it aur or depo
Kshutdown is an option, but not that rich in feature.
I want it to suspend my pc after timeshift finish backup… no idea if that works…
with windows os autoshutdown app, it can set to shutdown after hdd is not much transfer rate
qshutdown is another one, but even less feature than kshutdown.
Ok.
I am trying kshutdown. but don’t know if it works.
I am running timeshift , doing backup for the first time for this laptop. running timeshift gui . I don’t know if timeshift will exit after finish backup… but trying anyway. because i need to sleep . late.
ha! the auto suspend after timeshift finish failed. When i wake up laptop from suspend this morning, it was not even finish timeshifting.
Something else made it sleep.
What are the features in a endea kde that make a laptop sleep ?
screen saver
power management TLP ?
3 ?
*if you will tell me i will obtain a complete list of it…
Why so complicated? I know you’re more into GUI’s but once you’ve set up Timeshift you can create a snapshot simply by running sudo timeshift --create in a terminal. Combine that with a suspend or shutdown command and you should be good to go.
Try the following in a terminal sudo timeshift --create && systemctl suspend
Wonderful! that’s was what i was looking for, simple no need to install this and that…
So timeshift have extra trick under it sleeve through terminal which gui does not have …
oh… i think it is nothing to do with timeshift isn’t it ? should be todo with linux terminal power of combining command.
I know tee can be use to tee the output to several outputs simultaneously, but have not learn about &&
May i know what is this && is under ? what should i search to get this && manual ? under OPERATOR ?
Although this cli is wonderful, the unique thing about cli that gui do not have (sometime, depent on the gui designer), but my laptop will auto suspend to ram before timeshift.
I am looking for ways this laptop will auto suspend.
could be screen saver, but i can’t find screen saver in display configuration.
or
power management…
or
screenlock
I have found this option and disabled it; System Settings > Hardware > Energy Saving > Suspend session (disable this option to disable auto suspend before timeshift finish backup)
but i guess should be there are other settings also have the ability to suspend the laptop before timeshift finish doing its’ job. something like screen saver, but i have not locate it yet.
&& (=logical AND) is used to chain commands together, such that the next command is run if and only if the preceding command exited without errors (or, more accurately, exits with a return code of 0).
Other operators, e. g.:
|| (=logical OR) is used to chain commands together, such that the next command is run if and only if the preceding command exited with errors (or, more accurately, exits with a return code > 0)
& (one &) is used to run the first command in the background and the second in the foreground; both commands run simultaneously
; runs the second command after the first, regardless of the error code
You can combine these of course, e. g. command1 && command2 ; command3
You can use different kinds of brackets too:
( cmd1 ; cmd2 && ... )
The following commands will start and run in their own shell.
{ cmd1 ; cmd2 && ... }
The following commands will start and run in the same shell.
To (temporarily prevent your Linux machine from sleeping and suspending, disable the following targets at the systemd level sudo systemctl mask sleep.target suspend.target Other possible targets are hibernate.target and hybrid-sleep.target.
Create your Timeshift snapshot sudo timeshift --create
Re-enable sleep and suspend on your system after Timeshift exited sudo systemctl unmask sleep. target suspend.target
Suspend the system systemctl suspend
==> One liner to disable suspend, run timeshift, re-enable suspend and finally suspend system: sudo sh -c 'systemctl mask sleep.target suspend.target ; timeshift --create ; systemctl unmask sleep.target suspend.target ; systemctl suspend'
so complicated. lol wow!
there is so much cli can do on linux… that i don’t know where to start and where to stop… !!
I was making note of everything related prevent or make computer shutdown or suspend… so much stuff…
I will surely try it . thanks
May i know is it that systemctl is having priority over all other things that causes a laptop to suspend ?
where systemctl do changes ? is it something link *.conf ?
The main command used to introspect and control systemd is systemctl. Some of its uses are examining the system state and managing the system and services.
systemd-suspend.service is a system service that is pulled in by suspend.target and is responsible for the actual system suspend. Note that systemd-suspend.service or systemd-hibernate.service should never be executed directly. Instead, trigger system sleep with a command such as systemctl suspend or systemctl hibernate.
By disabling (“masking”) the targets a symlink to /dev/null is created. From now on all attempts to invoke suspend or hibernate will be sent to /dev/null. Whatever you write to /dev/null will be discarded, forgotten into the void. It’s known as the null device in a UNIX system.
So if systemd is your main system and service manager this should theoretically have priority and keep your system from suspending. You’ll have to test this on your system yourself though.
Btw, you can check the .targets with systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target
If you see something like “Loaded: masked (/dev/null; bad)” the service is disabled, otherwise it will show “Loaded: loaded (...”.
I just tried you single liner command … and it straight away goes into suspend mode.
I thought what script is that… does not work…
Than i realized i have a timeshift gui opened… *although it just open and do nothing. apparently that hinder the code from you to run. but since i closed the timeshift gui, it works… all thru cli… never experience timeshift in cli before…
something not that right…i never use this cli that you gave me before, hence i have no idea what is happening.
$ sudo sh -c 'systemctl mask sleep.target suspend.target ; timeshift --create ; systemctl unmask sleep.target suspend.target ; systemctl suspend'
Created symlink /etc/systemd/system/sleep.target → /dev/null.
Created symlink /etc/systemd/system/suspend.target → /dev/null.
/dev/sdc is mounted at: /run/timeshift/backup, options: rw,relatime
------------------------------------------------------------------------------
Creating new snapshot...(RSYNC)
Saving to device: /dev/sdc, mounted at path: /run/timeshift/backup
Synching files with rsync...
102.81% complete (00:00:00 remaining)
this status was there for quite sometime already…
so… is the timeshift ended doing it’s job ?
why the command prompt shows over 100% ? and the (00:00:00 remaining) ? it has being in remaining time 0:0:0 for quite sometime already… still there.
I thought it has frozen or ended , but still showing that…
but as i was typing, the % changed to 104.05% with (00:00:00 remaining).
How come it took so long for timeshift to backup ?
Accidentally happened, as i was trying to copy the output of the timeshift. instead of copy, i cancelled it…
hence i restarted the exact same command again… it still not running fast.
for 5 minutes already, but only at 10%… is that consider fast ? for a timeshift that i have just done a couple minutes ago ?