Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Creating BASH Script to Run Redshift on Startup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Atomic Beef
n00b
n00b


Joined: 17 Mar 2014
Posts: 37

PostPosted: Tue Apr 08, 2014 12:46 am    Post subject: Creating BASH Script to Run Redshift on Startup Reply with quote

Hello everyone! This may seem like a n00bish question, but how do I create a script to run redshift on default? It's annoying to have to enter the command on startup every single time, so I wanted to automate this (sort of like f.lux.) I have created a script like this so far:

#!/bin/sh
sleep 20 &&
redshift -l 41.8350:73.0119 -t 6500:3400
sleep 20

I am using Enlightenment, so I created a new application pointing toward the script and set it to run on startup. However, on startup it says "Redshift has quit unexpectedly" and when clicking on "Advanced" it says "Redshift quit with error code 124." Does anyone know how to fix this? Sorry if I placed this in the wrong section and thanks in advance.

--Atomic Beef
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Apr 08, 2014 3:13 am    Post subject: Re: Creating BASH Script to Run Redshift on Startup Reply with quote

Atomic Beef wrote:
[...] how do I create a script to run redshift on default? It's annoying to have to enter the command on startup every single time

Atomic Beef ... how are you starting your WM, if via 'startx' then you can add the command to ~/.xinitrc.

As for the script, its probably a question of redshift (which I have no experience with) not being provided the DISPLAY, something which I suspect it will require if started from a script outside of X11.

Code:
#!/bin/sh

DISPLAY=":0"
redshift -l 41.8350:73.0119 -t 6500:3400

BTW, why is there 'sleep 60' before and after the command, I can't see why that might be necessary.

best ... khay
Back to top
View user's profile Send private message
Atomic Beef
n00b
n00b


Joined: 17 Mar 2014
Posts: 37

PostPosted: Tue Apr 08, 2014 8:20 pm    Post subject: Re: Creating BASH Script to Run Redshift on Startup Reply with quote

khayyam wrote:
Atomic Beef wrote:
[...] how do I create a script to run redshift on default? It's annoying to have to enter the command on startup every single time

Atomic Beef ... how are you starting your WM, if via 'startx' then you can add the command to ~/.xinitrc.

As for the script, its probably a question of redshift (which I have no experience with) not being provided the DISPLAY, something which I suspect it will require if started from a script outside of X11.

Code:
#!/bin/sh

DISPLAY=":0"
redshift -l 41.8350:73.0119 -t 6500:3400

BTW, why is there 'sleep 60' before and after the command, I can't see why that might be necessary.

best ... khay


Hey khay! Thanks for you reply. I use LXDM as my display manager, so adding anything to my ~/.xinitrc wouldn't do anything. As for the 'sleep 60' I have no idea, as I was searching on how to do this and found a post on the Arch forums on how to autostart Conky, so I just used whatever knowledge I had of BASH (which is admittedly very little) to try to make a working script. Some people were saying that you could right-click the redshift icon and then click autostart, but I don't where Enlightenment keeps its icons (think of something like the tray of open applications in Windows 7.) Also, this is completely unrelated and I know it's very subjective, but what WM do you think is good? What are you using now? Cheers!

--Atomic Beef
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Apr 09, 2014 12:04 am    Post subject: Re: Creating BASH Script to Run Redshift on Startup Reply with quote

Atomic Beef wrote:
Hey khay! Thanks for you reply.

hey ... you're welcome ...

Atomic Beef wrote:
I use LXDM as my display manager, so adding anything to my ~/.xinitrc wouldn't do anything.

well, its more a question of how its started, if via a graphical login manager (xdm/gdm/kdm/slim) then .xinitrc isn't used, otherwise it is.

Atomic Beef wrote:
As for the 'sleep 60' I have no idea, as I was searching on how to do this and found a post on the Arch forums on how to autostart Conky, so I just used whatever knowledge I had of BASH (which is admittedly very little) to try to make a working script.

I see ... well, you really only need a 'sleep' if something requires a waiting period, and I doubt this is the case with this specific script. Anyhow, you didn't mention if the above worked or not.

Atomic Beef wrote:
Some people were saying that you could right-click the redshift icon and then click autostart, but I don't where Enlightenment keeps its icons (think of something like the tray of open applications in Windows 7.)

Some DE's provide this autostart functionality, I'm not familiar with current enlightenment so I can't say if it does or not. However the above advice sounds more like the facility provided by gnome, xfce, or kde.

Atomic Beef wrote:
Also, this is completely unrelated and I know it's very subjective, but what WM do you think is good? What are you using now?

I use i3wm (x11-wm/i3). I perfer it as its keyboard driven and doesn't get in the way.

best ... khay
Back to top
View user's profile Send private message
Atomic Beef
n00b
n00b


Joined: 17 Mar 2014
Posts: 37

PostPosted: Wed Apr 09, 2014 12:24 am    Post subject: Re: Creating BASH Script to Run Redshift on Startup Reply with quote

khayyam wrote:
Atomic Beef wrote:
Hey khay! Thanks for you reply.

hey ... you're welcome ...

Atomic Beef wrote:
I use LXDM as my display manager, so adding anything to my ~/.xinitrc wouldn't do anything.

well, its more a question of how its started, if via a graphical login manager (xdm/gdm/kdm/slim) then .xinitrc isn't used, otherwise it is.

Atomic Beef wrote:
As for the 'sleep 60' I have no idea, as I was searching on how to do this and found a post on the Arch forums on how to autostart Conky, so I just used whatever knowledge I had of BASH (which is admittedly very little) to try to make a working script.

I see ... well, you really only need a 'sleep' if something requires a waiting period, and I doubt this is the case with this specific script. Anyhow, you didn't mention if the above worked or not.

Atomic Beef wrote:
Some people were saying that you could right-click the redshift icon and then click autostart, but I don't where Enlightenment keeps its icons (think of something like the tray of open applications in Windows 7.)

Some DE's provide this autostart functionality, I'm not familiar with current enlightenment so I can't say if it does or not. However the above advice sounds more like the facility provided by gnome, xfce, or kde.

Atomic Beef wrote:
Also, this is completely unrelated and I know it's very subjective, but what WM do you think is good? What are you using now?

I use i3wm (x11-wm/i3). I perfer it as its keyboard driven and doesn't get in the way.

best ... khay


Hi khay, I think I'm just going to have to live with redshift behaving as it is. For some reason, even if it's 8 AM, it decides to make my screen extremely orange, to the point that I can't even recognize blue from orange. Thanks for providing me with some BASH knowledge on the side :) I'll also check out i3wm. Cheers!

--Atomic Beef
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum