linux auto suspensd stop 1

linux auto suspensd stop

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Here is what the above code is Doing:
1. Create a new file in /etc/systemd/system/ called sleep.target.wants/sleep@username.service
2. Add the following code to the file:
[Unit]
Description=Sleep
Before=sleep.target
IgnoreOnIsolate=yes

[Service]
Type=simple
ExecStart=/bin/sh -c “/usr/bin/logger -t sleep ‘Sleeping…’; /usr/sbin/pm-suspend”
ExecStop=/bin/sh -c “/usr/bin/logger -t sleep ‘Resuming…’; /usr/sbin/pm-suspend –thaw”

[Install]
WantedBy=sleep.target

3. Create a new file in /etc/systemd/system/ called sleep.target.wants/sleep@username.service
4. Add the following code to the file:
[Unit]
Description=Sleep
Before=sleep.target
IgnoreOnIsolate=yes

[Service]
Type=simple
ExecStart=/bin/sh -c “/usr/bin/logger -t sleep ‘Sleeping…’; /usr/sbin/pm-suspend”
ExecStop=/bin/sh -c “/usr/bin/logger -t sleep ‘Resuming…’; /usr/sbin/pm-suspend –thaw”

[Install]
WantedBy=sleep.target

5. Create a new file in /etc/systemd/system/ called sleep.target.wants/sleep@username.service
6. Add the following code to the file:
[Unit]
Description=Sleep
Before=sleep.target
IgnoreOnIsolate=yes

[Service]
Type=simple
ExecStart=/bin/sh -c “/usr/bin/logger -t sleep ‘Sleeping…’; /usr/sbin/pm-suspend”
ExecStop=/bin/sh -c “/usr/bin/logger -t sleep ‘Resuming…’; /usr/sbin/pm-suspend –thaw”

[Install]
WantedBy=sleep.target

7. Create a new file in /etc/systemd/system/ called sleep.target.wants/sleep@username.service
8. Add the following code to the file:
[Unit]
Description=Sleep
Before=sleep.target
IgnoreOnIsolate=yes

[Service]
Type=simple
ExecStart=/bin/sh -c “/usr/bin/logger -t sleep ‘Sleeping…’; /usr/sbin/pm-suspend”
ExecStop=/bin/sh -c “/usr/bin/logger -t sleep ‘Resuming…’; /usr/sbin/pm-suspend –thaw”

[Install]
WantedBy=sleep.target

9. Create a new file in /etc/systemd/system/ called sleep.target.wants/sleep@username.service
10. Add the following code to the file:
[Unit]
Description=Sleep
Before=sleep.target
IgnoreOnIsolate=yes

[Service]
Type=simple
ExecStart=/bin/sh -c “/usr/bin/logger -t sleep ‘Sleeping…’; /usr/sbin/pm-suspend”
ExecStop=/bin/sh -c “/usr/bin/logger -t sleep ‘Resuming…’; /usr/sbin/pm-suspend –thaw”

[Install]
WantedBy=sleep.target

11. Create a new file

Similar Posts