0

How do I create a startup command permanent on every cycle restart ? As previously having brightness reset when set at power saving mode to turn off the monitor.

  • 18.04 64bits 5.4.0-42-generic
  • Desktop Nvidia 440 driver

I found out xset dpms 600 900 1800 works on turning off the monitor display but I wanted it to run at startup which i do no need to type manually on the terminal.

I tried adding xset dpms 600 900 1800 to the bottom of home/.profile but it didn't work.

Further testing and by adding an extra line to run terminal by adding

xset dpms 600 900 1800
gnome-terminal

at the terminal startup checking the xset -q xset dpms was not set Standby: 0 Suspend: 0 Off: 0 while it should be Standby: 600 Suspend: 900 Off: 1800

The weird scenario is when manually launch a terminal without typing anything , the command of xset dpms 600 900 1800 active.

What would it be the reason ? .profile with command 'xset dpms 600 900 1800' Not trigger on startup but when I launch terminal manually it trigger the command.

If anyone could explain the reason ? or a better way to run the command on startup rather running on .profile ?

ubusr
  • 11
  • 3
  • 4
    Does this answer your question? [How to run scripts on start up?](https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up) See this answer: https://askubuntu.com/a/500147/480481 – pomsky Aug 14 '20 at 02:26
  • The display manager doesn't necessarily load your `.profile`. LightDM does, I think, but GDM hasn't done that for a while. – muru Aug 14 '20 at 08:24
  • @pomsky , the startup askubuntu.com/a/500147/480481 does not work.Does it work on 18.04.5 ? – ubusr Aug 15 '20 at 16:39
  • It should work. If it doesn't for you, consider editing your question with details and full content of the `.desktop` file. – pomsky Aug 15 '20 at 16:52
  • @pomsky my script https://paste.ubuntu.com/p/JmGmqcsjwF/ at autostart sh.desktop https://paste.ubuntu.com/p/gWB6bktHrF/ . – ubusr Aug 16 '20 at 12:39

1 Answers1

0

The X Server, which listens for the xset command, starts after login.

Place the command in a script, and put the script in your ~/.config/autostart/ directory. It will run every time the X Server is started for your account.

user535733
  • 58,040
  • 10
  • 106
  • 136
  • I paste the script `#!/bin/bash # Turn off Monitor xset dpms 900 1200 1800 exit` and save as .sh , chmod it 776 still it does not run.Just tell me , is my script wrong ? Just a simple command line. @user535733 – ubusr Aug 15 '20 at 16:44