Starting script to set monitor configuration
3
votes
1
answer
4165
views
Morning all, I am trying to run a little script on startup I wrote to configure my desktop if the VGA1 output is connected (which it is). Running BunsenLabs-Hydrogen (Debian based).
Script:
#!/bin/bash
### BEGIN INIT INFO
# Provides: resVGA1
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Setup xrandr with VGA1
# Description: Setup Multi-screen resolution with VGA1 connected
### END INIT INFO
if xrandr | grep "VGA1 connected"; then
xrandr -s 1366x768 #As it doesn't default to this with VGA1 connected
xrandr --auto #To populate the second screen
xrandr --output VGA1 --right-of LVDS1 #Right of VGA1, not duplicate
fi
I've made the script executable and it works when called, then placed it in /etc/init.d/ and ran:
update-rc.d resVGA1 defaults
The output of "ls -l /etc/rc?.d/*resVGA*" is:
lrwxrwxrwx 1 root root 17 Dec 19 12:33 /etc/rc0.d/K01resVGA1 -> ../init.d/resVGA1
lrwxrwxrwx 1 root root 17 Dec 19 12:33 /etc/rc1.d/K01resVGA1 -> ../init.d/resVGA1
lrwxrwxrwx 1 root root 17 Dec 19 12:33 /etc/rc2.d/S01resVGA1 -> ../init.d/resVGA1
lrwxrwxrwx 1 root root 17 Dec 19 12:33 /etc/rc3.d/S01resVGA1 -> ../init.d/resVGA1
lrwxrwxrwx 1 root root 17 Dec 19 12:33 /etc/rc4.d/S01resVGA1 -> ../init.d/resVGA1
lrwxrwxrwx 1 root root 17 Dec 19 12:33 /etc/rc5.d/S01resVGA1 -> ../init.d/resVGA1
lrwxrwxrwx 1 root root 17 Dec 19 12:33 /etc/rc6.d/K01resVGA1 -> ../init.d/resVGA1
So to my knowledge this should work on startup, but it doesn't - I checked /var/log/syslog and found the following reports:
Dec 19 12:33:46 DankPad resVGA1: Can't open display
Dec 19 12:33:46 DankPad kernel: [ 0.244129] ACPI: bus type PNP unregistered
Dec 19 12:33:46 DankPad kernel: [ 0.250523] pci 0000:00:1c.0: PCI bridge to [bus 02]
Dec 19 12:33:46 DankPad systemd: Started LSB: Setup xrandr with VGA1.
Dec 19 12:33:46 DankPad kernel: [ 0.250541] pci 0000:00:1c.1: PCI bridge to [bus 03]
Dec 19 12:33:46 DankPad kernel: [ 0.250548] pci 0000:00:1c.1: bridge window [mem 0xf2400000-0xf24fffff]
Dec 19 12:33:46 DankPad kernel: [ 0.250560] pci 0000:00:1c.3: PCI bridge to [bus 05-0c]
Am I doing something wrong or just fundamentally misunderstanding what I'm trying to do?
Any help would be appreciated.
Asked by BodneyC
(33 rep)
Dec 19, 2016, 01:08 PM
Last activity: Dec 19, 2016, 01:33 PM
Last activity: Dec 19, 2016, 01:33 PM