peter12 Posted March 23, 2017 Posted March 23, 2017 please, I am really helpless. I am on Armbian. I am trying to run hyperion-v4l2 in /etc/rc.local (please it is not important why for now) with these parameters: Code: /home/user/hyperion/build/bin/hyperion-v4l2 --device /dev/video0 --video-standard PAL --width 720 --height 576 --crop-top 10 --crop-bottom 10 --crop-left 24 --crop-right 24 --frame-decimator 1 --size-decimator 4 --red-threshold 0.2 --green-threshold 0.4 --blue-threshold 1.0 (before v4l2 I am executing sudo /home/user/hyperion/build/bin/hyperiond /home/user/hyperion.config.json) But it does not take crop parameters in effect (important for blackborder detection) of hyperion-v4l2. I tried to put the whole command in sh and python script (subprocess) but it is the same, in rc.local crop parameters are omitted, no idea why. BUT when I execute the same SH or Python script when I log in via my user, it works correctly. What can be wrong? In rc.local and all executed scripts via rc.local it does not take crop parameters in effect. Maybe the line with parameters is very long, but I don't understand it because manually the same scripts work correctly. UPDATE: After several trial and errors I found out, probably, it is related to THIS sudo /home/user/hyperion/build/bin/hyperiond /home/user/hyperion.config.json. Because when I run this script via rc.local and then manually hyperion-v4l2, then behaviour is the same.
zador.blood.stained Posted March 23, 2017 Posted March 23, 2017 Why are you using sudo when running from rc.local? Most likely sudo eats your double dash arguments instead of passing them to the program. While you can add a double dash before those arguments to avoid this issue, you may as well drop sudo invocation at all if you want to run this process as root.
zador.blood.stained Posted March 23, 2017 Posted March 23, 2017 Does it use any kind of configuration files stored in /home? Looks like it does based on your first posts. Processes started from /etc/rc.local will be started as root, so their home directory will be /root, so your program may be searching for its configuration files in wrong directory
peter12 Posted March 23, 2017 Author Posted March 23, 2017 4 minutes ago, zador.blood.stained said: Does it use any kind of configuration files stored in /home? Looks like it does based on your first posts. Processes started from /etc/rc.local will be started as root, so their home directory will be /root, so your program may be searching for its configuration files in wrong directory I don't think so. Program is not trying to search for config files. According to my opinion program just not receive the right parameters, but no idea why. When I try to execute the same program with/without sudo via terminal, it works ok (It gets parameters ok).
zador.blood.stained Posted March 23, 2017 Posted March 23, 2017 (edited) 12 minutes ago, peter12 said: According to my opinion program just not receive the right parameters, but no idea why. Please run "ps ax" to get the PID of hyperion-v4l2 (running from rc.local) and then run "ps -o args -p <pid> | tail", i.e. ps -o args -p 1234 | tail There you'll see command line passed to hyperion-v4l2 so you can check if it is correct or not Edited March 23, 2017 by zador.blood.stained Added | tail to wrap long lines
peter12 Posted March 23, 2017 Author Posted March 23, 2017 UPDATE: After several trial and errors I found out, probably, it is related to THIS sudo /home/user/hyperion/build/bin/hyperiond /home/user/hyperion.config.json. Because when I run this script via rc.local and then manually hyperion-v4l2, then behaviour is the same.
Recommended Posts