You are not logged in.

#1 2012-12-15 23:52:00

Registered: 2012-06-19
Posts: 33

[SOLVED] Why some commands run properly in startup script others don't

I am trying to finish setting up my MythTV box. I have the following commands to run at startup:


# Stop spamming dmesg
echo -n 0000:00:06.1 > /sys/bus/pci/drivers/ehci_hcd/unbind

# Enable wake from remote
echo enabled > /sys/bus/usb/devices/4-5/power/wakeup

# Link optical drive to /dev/dvd (needed for myth)
if [ ! -e /dev/dvd ]; then ln -s /dev/cdrom /dev/dvd; fi

# Start LIRC
echo lirc > /sys/class/rc/rc0/protocols
ln -sf /run/lirc/lircd /dev/lircd
lircd -d /dev/lirc0 /etc/lirc/hipermc

# Start mythbackend
mythbackend &

# Start LCD server
LCDd &

I have tried making this part of rc.local and also as a startup item in XFCE (with script called using passwordless sudo since it requires root permissions). In each case, only some of the commands run properly (the dmesg, wake from remote, and start LIRC sections). The other commands don't seem to work. However if I run the script manually after the computer has finished booting, everything works perfectly. Can anyone help me figure out what's going wrong?

It seems like path is already set since some commands do work without the full pathname. Also please don't suggest using systemd for starting the daemons - it does not work for me with LIRC or lcdproc and there is a driver bug with my hardware that keeps me from using the mythbackend systemd service.

Thanks in advance for the help.

Last edited by mosquitogang201 (2012-12-16 14:42:11)


#2 2012-12-16 00:08:23

From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Why some commands run properly in startup script others don't

I am not sure why things are not working, but if you are using systemd, what you probably want are systemd tmpfiles for most of it.  For the dvd symlink, that can be achieved with a udev rule.  Actually quite a bit of the others could also be achieved witha udev rule as well.

Basically the rc.local method has always been kind of a crude hack (yet an amazing convenience), so it would probably be better if you figured out the right way to go about things here.


#3 2012-12-16 10:45:35

Registered: 2012-02-25
Posts: 94

Re: [SOLVED] Why some commands run properly in startup script others don't

Get logs from your script adding

exec 1>/var/log/rclocalstderr 2>/var/log/rclocalstderr

at the beginnig

About your systemd problems: FYI in a month or so you will need to use it if you want to keep your Arch updated.


#4 2012-12-16 14:08:06

Registered: 2012-06-19
Posts: 33

Re: [SOLVED] Why some commands run properly in startup script others don't

The exec command was what I needed. Was able to follow the error messages to find out the command im using under "stop spamming dmesg" was messing everything else up. Also I am running systemd - just not using it to start these items since the systemd service files weren't working reliably.

Anyways this brings me to another question - is there a more elegant way to stop dmesg from getting spammed? About 5 times per second I get the error

hub 2-4:1.0: unable to enumerate USB device on port 3

which makes it very difficult to look through dmesg logs to find an actual problem.

EDIT: Just needed to add the sleep command after the dmesg section to give the kernel enough time to reload using ohci_hcd. Now script is working perfectly. Marking as SOLVED.

Last edited by mosquitogang201 (2012-12-16 14:48:47)


Board footer

Powered by FluxBB