I am trying get a python script to run on startup using insserv or executing the script using /etc/rc.local. The python script enables keyboard shortcuts for snapping windows to the edges of the screen (https://github.com/paulswartz/gnome-shell-grid).
When I use rc.local I found that I get errors related to the display presumably because the screen isn't ready at the point that rc.local is executed. Here is the error log:
Code: Select all
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
Traceback (most recent call last):
File "/home/gareth/bin/gnome-shell-grid/gnome-shell-grid.py", line 192, in <module>
File "/home/gareth/bin/gnome-shell-grid/gnome-shell-grid.py", line 147, in main
display = Xlib.display.Display()
File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 83, in __init__
self.display = _BaseDisplay(display)
File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 65, in __init__
apply(protocol.display.Display.__init__, (self, ) + args, keys)
File "/usr/lib/pymodules/python2.7/Xlib/protocol/display.py", line 44, in __init__
name, host, displayno, screenno = connect.get_display(display)
File "/usr/lib/pymodules/python2.7/Xlib/support/connect.py", line 65, in get_display
File "/usr/lib/pymodules/python2.7/Xlib/support/unix_connect.py", line 59, in get_display
Xlib.error.DisplayNameError: Bad display name ""
Alternatively I was going to try using insserv but whenever I try to run insserv I get 'command not found'. To ensure it was installed I ran 'apt-get install insserv' and I am apparently at the latest version already.
I would like to remove and reinstall but when I try to remove insserv I get a warning that I am about to do something dangerous and potentially harmful.
So I have 2 questions really:
1) Can I use insserv to get this script to run at startup after the display is ready?
and if so:
2) why can I not run insserv if it is apparently installed?
Thanks in advance,