redshift is not a system service; it works within your login session, as it needs to access the X11 server. So basically it should be autostarted the same way most graphical programs are:
Add a file
redshift.desktop to the XDG Autostart directory,
This works with desktop environments that follow the XDG Autostart spec; this includes GNOME, KDE, Xfce, and many others. In some, it is editable through graphical interfaces (e.g.
gnome-session-properties in GNOME).
Add the following line...
~/.xprofile. This works with most display managers (gdm, kdm, lightdm, lxdm, sddm – not slim, however).
If you use the startx tool,
~/.xprofile is not used by default, so you'll have to update your
~/.xinitrc script instead – add the same line somewhere before starting the session manager.
If you use a display manager like GDM, you might want to run the program before logging in, so that it'd apply to the login screen as well. How to do this varies between display managers, but in GDM it can be done by editing
/etc/gdm/Init/Default. (Disclaimer: I haven't tried and this might be the wrong file.)
Things that will not work
A system init script will not work since it runs independently of graphical sessions – it won't have the right
$DISPLAY nor the right
$XAUTHORITY set; if you hardcode those, it might end up trying to connect to the wrong display (e.g. you hardcode
DISPLAY=":0" but your session happens to start at
:1); and if you make it try all displays, the script is still very likely to start before any X11 display has been started.
@reboot cronjob will run as the right user (rather than needing to
sudo), but otherwise it has all the same problems as system init scripts.