Topic: need help configuring pianoteq for headless linux-mint

No problem running pianoteq with a terminal attached to my NUC running linux mint 17.3.

Like to run it headless but am hitting some roadblocks. Here's how I kick it off from a terminal:
cd "/home/mark/pianoteq/Pianoteq 5 STAGE/i386/"
nohup "./Pianoteq 5 STAGE" > /home/mark/pianoteq.log 2>&1 &


Here's my attempt to kick it off from cron headless:

@reboot /home/mark/pianoteq/pianoteq_kickoff_cron.sh > /home/mark/pianoteq_cron.log 2>&1

mark@nuc-piano ~/pianoteq $ cat /home/mark/pianoteq/pianoteq_kickoff_cron.sh
#!/bin/bash
cd "/home/mark/pianoteq/Pianoteq 5 STAGE/i386/"
"./Pianoteq 5 STAGE" --headless > /home/mark/pianoteq.log 2>&1 

No sound from piano and my logs are empty, pianoteq is running:

mark@nuc-piano ~/pianoteq $ ps aux|grep -i pianoteq|grep -v grep
mark      1211  0.0  0.0   4448   688 ?        Ss   14:55   0:00 /bin/sh -c /home/mark/pianoteq/pianoteq_kickoff_cron.sh > /home/mark/pianoteq_cron.log 2>&1
mark      1212  0.0  0.0  12400  2636 ?        S    14:55   0:00 /bin/bash /home/mark/pianoteq/pianoteq_kickoff_cron.sh
mark      1213  2.1  3.0 182908 121464 ?       Sl   14:55   0:05 ./Pianoteq 5 STAGE --headless
mark@nuc-piano ~/pianoteq $ 

I subsequently inserted
/usr/bin/pulseaudio --start
into the kickoff script on a hunch that maybe pulseaudio wasn't ready before pianoteq, but made no difference.

Perhaps an init.d script is required but I don't know the dependencies.

Any ideas?

Thanks,
Mark M

Last edited by markmarz (16-02-2016 22:05)

Re: need help configuring pianoteq for headless linux-mint

I can't reproduce the problem just running headless from the command line. It works fine on my Linux Mint 17.2 Dell laptop.

Is it just when you run it as a @reboot cron job or also when you run it headless from the terminal?

My guess is @reboot is too soon and some system services required aren't ready. On a machine I've set up Pianoteq to start automatically on bootup but it's run as a one of the Desktop environment's (fluxbox) start-up programs rather than as a cron job. If you want to do it with cron perhaps a sleep command of suitable duration before starting Pianoteq could help.

3/2 = 5

Re: need help configuring pianoteq for headless linux-mint

Thanks for your reply.

Yes, I should have made the method clear. I can, when logged into a terminal, kick off a script that runs in the background which kicks off pianoteq --headless just fine.

The problem is when I rely on cron to kick it off, ie, at boot time without a terminal. I'm sure you're right, there's some dependency but it would be hit and miss to guess what it could be. I thought of your suggestion to just delay the kickoff with a timer, and I suppose I'll try it, but it seemed sort of haphazard. Also I don't know when @reboot is honored exactly, but I suppose a long enough delay would cover the bases.

I'd rather know what the dependencies are and code for them in an init.d script, but maybe that's too hard.

Re: need help configuring pianoteq for headless linux-mint

Well, that didn't work. Tried sleeping for 60 seconds .. the NUC only takes about 20 seconds to reboot .. and still no sound.

I read somewhere that something .. pulseaudio I think .. is normally kicked off when X is initialized, but since there is no X, no pulseaudio. That's why I tried injecting pulseaudio into the script.

Huh. Well, mostly the NUC will never reboot since it cost about $8.50 a year to run it 24/7. But I hate the idea that I have to be tied to a terminal to kick it off. I'll keep digging.

Last edited by markmarz (16-02-2016 23:45)

Re: need help configuring pianoteq for headless linux-mint

If you're setup for auto login, then you could also just run pianoteq by adding it to your login manager's start-up script. (You still may need a sleep command to let the desktop and window manager properly load first.) What desktop environment are you using?

Last edited by SteveLy (17-02-2016 00:12)
3/2 = 5

Re: need help configuring pianoteq for headless linux-mint

MATE

Linux Mint 17.3 64 bit

I'm not familiar with "login manager's start-up script", please explain.

Re: need help configuring pianoteq for headless linux-mint

Oh, you mean like this?

http://xmodulo.com/start-program-automa...sktop.html

Re: need help configuring pianoteq for headless linux-mint

Perfect! I tried without sleep and it didn't work, but sleeping 30 seconds works fine. Maybe I can cut it back a little.

Thanks a million!

Re: need help configuring pianoteq for headless linux-mint

I use that above method mentioned -- using the desktop's autostart function.

And it does need a sleep for all the services to initialize first.  I make a script that executes:

  * sleep 10
  * pianoteq start

Then inside the autostart option, I make it run "pianoteq_start &" so it runs in the background and doesn't stop the desktop services from starting up.

Re: need help configuring pianoteq for headless linux-mint

Cool, I'll tweak it that way. So the autostarts don't kick off the configured tasks in the background anyway?

Thanks! Love this forum.

Re: need help configuring pianoteq for headless linux-mint

Glad you got it working. Autostart scripts don't necessarily know about what each program needs, especially ones not part of your distro.

What I had trouble with is auto shutdown after exiting Pianoteq. I never really solved it properly but when I have time I'll look into it again. I just want a setup that's dead easy for young students and their parents to use. My partner's a piano teacher and we would like to be able to loan out small laptops with Pianoteq on it for students to try out at home with minimal hassle. Just turn it on wait for bootup straight into a full-screen Pianoteq interface and play. Then when exiting Pianoteq, the computer should automatically shut down.

3/2 = 5

Re: need help configuring pianoteq for headless linux-mint

These laptops will be running Linux of some flavor? I reckon you've seen this, right?

http://unix.stackexchange.com/questions...-completed