Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1

    irexec doesn't autostart from "User commands" in v6.1.0

    Per Ralphy's suggestion, I found that running irexec daemonized allows me to invoke custom scripts via IR remote. I added irexec to Tweaks->User commands, but irexec never survives reboot:

    Name:  pcp-no-irexec.JPG
Views: 355
Size:  53.9 KB

    I find nothing in Main->Diagnostics indicating that it started. Irexec invocation is in pcp.cfg, perhaps a HTML translation problem?

    Code:
    AUTOSTARTLMS=""
    A_S_LMS="Disabled"
    AUTOSTARTFAV="Random songs"
    A_S_FAV="Enabled"
    USER_COMMAND_1="%2Fusr%2Flocal%2Fbin%2Firexec+-d"
    USER_COMMAND_2=""
    USER_COMMAND_3=""
    JIVELITE="no"
    In any case, is there a manual pcp.cfg fix, or another way for me to invoke "/usr/local/bin/irexec -d" at boot time? Thanks!

  2. #2

    It's not character URL (percent) encoding

    On a tip from https://www.brianlinkletter.com/pers...inycore-linux/, I manually edited /usr/local/etc/pcp/pcp.cfg and removed the percent-encoding from USER_COMMAND_1:

    USER_COMMAND_1="/usr/local/bin/irexec -d"

    I then made this configuration persistent:

    sudo filetool.sh -b

    and rebooted. My pcp.cfg edit remains, but there is still no irexec running:

    Code:
    tc@piCorePorch:/usr/local/etc/pcp$ ps auxw | grep ire
     8586 tc        0:00 grep ire
    /var/log/pcp_boot.log shows that LIRC is started before the user commands (sorry for encoding, can't figure out how to get rid of it in PuTTY):

    Code:
    [1;34mLoading configuration file...[[0;39m [[1;32mDone.[[0;39m
    [[1;34mLoading pcp-lms-functions...[[0;39m [[1;32mDone.[[0;39m
    [[1;33mWaiting for soundcard IQaudIODAC to populate. [[1;32mDone (1).[[0;39m
    [[1;33mWaiting for network. [[1;32mDone (1).[[0;39m
    [[1;34mStarting lirc...[[0;39m [[1;32mDone.[[0;39m
    [[1;34mStarting Openssh server...[[0;39m [[1;32mDone.[[0;39m
    [[1;34mStarting Squeezelite and/or Shairport-sync...[[1;33m
    [ INFO ] Starting Squeezelite player: Squeezelite...
     [[1;32mDone.[[0;39m
    [[1;34mStarting httpd web server...[[0;39m [[1;32mDone.[[0;39m
    [[1;34mStarting user commands...[[0;39m [[1;32mDone.[[0;39m
    [[1;34mStarting auto start Favorites...[[0;39m [[1;32mDone.[[0;39m
    [[1;34mSetting CPU scaling governor to ondemand... [[1;32mDone.[[0;39m
    [[1;34mCreating static footer...[[0;39m [[1;32mDone.[[0;39m
    
    [[1;32mFinished piCorePlayer v6.1.0 startup.[[0;39m
    Any ideas for either adding more detailed logging to the user commands, or another startup file to manipulate?

  3. #3

    This is a PCP bug, but I can kludge around it with .profile

    OK, I managed to get irexec running daemonized at boot. To do so, I had to add it to /home/tc/.profile (excerpt):

    Code:
    if [ -f "$HOME/.ashrc" ]; then
       export ENV="$HOME/.ashrc"
       . "$HOME/.ashrc"
    fi
    
    # Can't start irexec from Tweaks->User Command, try it here
    /usr/local/bin/irexec -d
    
    TERMTYPE=`/usr/bin/tty`
    [ ${TERMTYPE:5:3} == "tty" ] && (
    [ ! -f /etc/sysconfig/Xserver ] ||
    [ -f /etc/sysconfig/text ] ||
    [ -e /tmp/.X11-unix/X0 ] ||
    startx
    Then persist the change with "sudo filetool.sh -b" and reboot.

    At this point, irexec starts automatically and can handle my custom remote scripts:

    Code:
    tc@piCorePorch:~$ ps auxw | grep ire
     3658 tc        0:00 /usr/local/bin/irexec -d
     5288 tc        0:00 grep ire
    Seems pretty clear that this is a bug in the Tweaks->User commands. Is there a separate reporting process?

  4. #4
    Senior Member
    Join Date
    Jul 2020
    Posts
    261
    Quote Originally Posted by Braklet View Post
    OK, I managed to get irexec running daemonized at boot. To do so, I had to add it to /home/tc/.profile (excerpt):

    Seems pretty clear that this is a bug in the Tweaks->User commands. Is there a separate reporting process?
    I've been running into the same problem, but for me this solution doesn't seem to work either...

    All seems to work fine if I start IREXEC manually, so this seems to me to be something that should be easy to fix.. But not sure where to start from here..

  5. #5
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    4,062
    Some processes may not like being backgrounded and then trying to daemonize. You likely don't need to use the "-d". Or you can just put what you want in a script, then put the script name in user commands.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  6. #6
    Senior Member
    Join Date
    Jul 2020
    Posts
    261
    Quote Originally Posted by paul- View Post
    Some processes may not like being backgrounded and then trying to daemonize. You likely don't need to use the "-d". Or you can just put what you want in a script, then put the script name in user commands.
    Thanks, I'll try that tomorrow. The other one (the power off script) does indeed seem to work, maybe I'll just combine both into one shell script.

  7. #7
    Quote Originally Posted by paul- View Post
    Some processes may not like being backgrounded and then trying to daemonize. You likely don't need to use the "-d". Or you can just put what you want in a script, then put the script name in user commands.
    Removing the "-d" daemonize option from the USER_COMMAND irexec invocation makes no difference. irexec still doesn't start from the tweak page.

    pCP still has a bug in the web server-to-user commands translation. It keeps inserting URL encoded HTML into pcp.cfg directly. For example, entering the following in the Tweaks->User Commands:
    Name:  pcp-user-command.PNG
Views: 59
Size:  16.9 KB

    results in /usr/local/etc/pcp/pcp.cfg content:

    Code:
    USER_COMMAND_1="%2Fhome%2Ftc%2Fboot-irexec.sh"
    instead of "/home/tc/boot-irexec.sh" .

    I attempted your second suggestion and created /home/tc/boot-irexec.sh:

    Code:
    #!/bin/sh
    /usr/local/bin/irexec -d
    I could SSH in and manually execute /home/tc/boot-irexec.sh, and the irexec process runs as expected. So the script is valid.

    I tried multiple tweaks->user command strings, including:
    • boot-irexec.sh
    • %2Fhome%2Ftc%2Fboot-irexec.sh (the value as written by the pCP Tweaks web page)
    • /home/tc/boot-irexec.sh (manually edited pcp.cfg)

    rebooting between each try. None of them resulted in irexec running.

    Seems pretty clear that there is a bug in the Tweaks->User Commands.

    I restored my /home/tc/.profile tweak, and irexec starts at boot once again. So that works for me, at least.

  8. #8
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    4,062
    The url encoding is correct, it gets decoded at run time, it's the best way to preserve spaces and such.

    I'll have to see what is so special about irexec as to why it doesn't want to run from a shell script.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  9. #9
    Quote Originally Posted by paul- View Post
    The url encoding is correct, it gets decoded at run time, it's the best way to preserve spaces and such.

    I'll have to see what is so special about irexec as to why it doesn't want to run from a shell script.
    OK, I can see how the encoding would help, it just wasn't clear if the encoding was causing my problem. Would a warning in the page help text be warranted? (I reckon that a user who plans to add something to "User commands" will likely be SSHing into pCP and looking under the covers.)

    I appreciate your taking a look at this. I found a workaround that suits me, but it seems awfully strange that the User command path didn't work for irexec.

    I regularly run a host of Squeeze* instances along with a Radio, and my pCP client is still my favorite player. Thanks again!

  10. #10
    Senior Member
    Join Date
    Jul 2020
    Posts
    261
    Quote Originally Posted by paul- View Post
    I'll have to see what is so special about irexec as to why it doesn't want to run from a shell script.
    When I tried that it seemed to have an issue with finding the lircrc file. Since I already had a startup .sh script, I added it there with the lircrc path:
    Code:
    #!/bin/sh
    #things to do at startup
    /usr/local/bin/irexec /home/tc/.lircrc &

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •