Skip to main content
edited tags
Link
Eduardo Trápani
  • 14.2k
  • 1
  • 21
  • 38
Source Link

Why is my systemd startup script not running properly? (ubuntu 20.04)

I have created two systemd startup scripts as per https://www.howtogeek.com/687970/how-to-run-a-linux-program-at-startup-with-systemd/, containing the following:

#1

#!/bin/bash

synclient RightButtonAreaLeft=0
synclient RightButtonAreaTop=0

#2

#!/bin/bash

modprobe -r ec_sys
modprobe ec_sys write_support=1

echo -n -e "\x0a" | sudo dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=12 count=1 conv=notrunc 2> /dev/null

while true; do
read -rsn1 input
if [[ size=${#input}!=0 ]]; then

    echo -n -e "\x8a" | sudo dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=12 count=1 conv=notrunc 2> /dev/null
    
fi
    
echo -n -e "\x0a" | sudo dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=12 count=1 conv=notrunc 2> /dev/null


done

When run manually, the scripts work as intended.

The top script disables the bottom-left RMB gesture on my touchpad, and the bottom one should turn an LED on and off when I type (https://www.reddit.com/r/thinkpad/comments/7n8eyu/thinkpad_led_control_under_gnulinux/), neither of these two have any effect when run automatically at startup, even when I have checked the service status to verify the have run/are running.

I have used the systemctl status servicename.service command which does not raise any obvious errors. While suggestions for fixes would be ideal, any alternative ways of running these scripts at startup are also welcome. I have already tried the init.d method, as well as the startup scripts setting in ubuntu, neither of which unfortunately worked.