how to set terminal command to auto start in login?
Tofloor
poster avatar
lokize
deepin
2018-03-20 06:24
Author
how to set command to auto start in login, my monitor is 240hz and every time I start the deepin I have to type the command xrandr -s 1920x1080 -r 240 in the terminal
Reply Favorite View the author
All Replies
teemo1993
deepin
2018-03-20 08:40
#1
hello? can you speek Chinese?
Reply View the author
kingskill
deepin
2018-03-20 09:03
#2
Reply View the author
lokize
deepin
2018-03-20 11:31
#3
https://bbs.deepin.org/post/154428
You can see here:

https://wiki.deepin.org/index.php?title=Autostart_program&language=en

i see this post but i not undertand nothing, i am new user in deepin...
Reply View the author
152******09
deepin
2018-03-20 12:02
#4
can u speak chinese ?  
are u chinese ?
Reply View the author
lokize
deepin
2018-03-20 12:07
#5
No, Brazilian
Reply View the author
lokize
deepin
2018-03-20 13:13
#6
Edited by lokize at 2018-3-20 05:15

i made a file called screen.sh in /home/lokize/.config/autostart with parameters:

[Desktop Entry]
Type=Application
Exec="/home/lokize/Documents/screen.sh"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_IN]=screen.sh
Name=screen.sh
Comment[en_IN]=screen.sh
Comment=screen.sh

and i make file in /home/lokize/Documents/screen.sh with parameters:

xrandr -s 1920x1080 -r 240

But not working!
Reply View the author
kingskill
deepin
2018-03-20 20:50
#7
sudo xrandr -s 1920x1080 -r 240

Maybe U should add the "sudo" at the top if U wanna auto start. U should have the root authority.
Reply View the author
kingskill
deepin
2018-03-20 21:01
#8
本帖最后由 kingskill 于 2018-3-20 13:03 编辑
https://bbs.deepin.org/post/154428
Edited by lokize at 2018-3-20 05:15

i made a file called screen.sh in /home/lokize/.config/autost ...

Or maybe U should do this:  
Make a hook in front of the option





Reply View the author
int_max
deepin
2018-03-20 21:07
#9
kingskill replied at 2018-3-20 13:01
本帖最后由 kingskill 于 2018-3-20 13:03 编辑



equivalent to the following shell command:
chmod +x someFile.sh
Reply View the author
int_max
deepin
2018-03-20 21:09
#10
lokize replied at 2018-3-20 05:13
i made a file called screen.sh in /home/lokize/.config/autostart with parameters:

[Desktop Entry]

I am not  very familiar with Deepin's auto-start feature but did you remember to execute `chmod +x yourScript.sh'?
Reply View the author
kingskill
deepin
2018-03-20 21:44
#11
https://bbs.deepin.org/post/154428
I am not  very familiar with Deepin's auto-start feature but did you remember to execute `chmod +x ...

Yes, it is.

The graphical interface is more convenient for freshman.

So...  XD
Reply View the author
int_max
deepin
2018-03-20 22:44
#12
kingskill 发表于 2018-3-20 13:44
Yes, it is.

The graphical interface is more convenient for freshman.

Alright, hope that you will solve it soon XDDDD.
Reply View the author
snsmqing
deepin
2018-03-20 23:15
#13
You can put the command in .bashrc file, it will be executed when you log in.

$ vi ~/.bashrc
xrandr -s 1920x1080 -r 240
Reply View the author
lokize
deepin
2018-03-21 04:15
#14
Edited by lokize at 2018-3-20 20:34
https://bbs.deepin.org/post/154428
You can put the command in .bashrc file, it will be executed when you log in.

$ vi ~/.bashrc

i try adding but working only i enter in terminal after first time, in login of system not working!
now it's working in a very inconvenient way, put the command inside the file you mentioned without the sudo, I added the terminal to start with deepin, now every time the system turns on the system it opens the terminal and runs the command automatically, however the terminal window is open until I close. LOL
Reply View the author
int_max
deepin
2018-03-21 08:29
#15
lokize 发表于 2018-3-20 20:15
Edited by lokize at 2018-3-20 20:34



Does crontab work with Deepin? If so, try it! Add a cron job like following:
@reboot sleep 2 && sh /somePath/someScript.sh
Crontab will execute the commands after `@reboot' at start up.
Reply View the author
132******85
deepin
2018-03-21 18:12
#16
~/.config/autostart/
Reply View the author
lokize
deepin
2018-03-21 18:49
#17

i tried, but not working too!
Reply View the author
snsmqing
deepin
2018-03-22 01:29
#18
https://bbs.deepin.org/post/154428
i try adding but working only i enter in terminal after first time, in login of system not working! ...

I can't test this command. maybe it has a graphical interface?
~/.bashrc is used to initialize the user environment It has nothing to do with terminals.
*
You can also put it in the /etc/rc.d/rc.local file. if without this file, create it.
1. $ sudo vi /etc/rc.d/rc.local
2. put command into bottom
3. $ sudo chmod +x /etc/rc.d/rc.local

Reply View the author
132******85
deepin
2018-03-22 17:39
#19
https://bbs.deepin.org/post/154428
i tried, but not working too!


Like this, my test is effective.

But my system environment is ubuntu+dde


Reply View the author