Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 31 Jul 2014, 20:06
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Shell script runs OK, but needs to keep going and doesn't...
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [22 Posts]   Goto page: 1, 2 Next
Author Message
starhawk

Joined: 22 Nov 2010
Posts: 2778
Location: Everybody knows this is nowhere...

PostPosted: Sun 30 Mar 2014, 14:38    Post subject:  Shell script runs OK, but needs to keep going and doesn't...
Subject description: Fluidsynth troubles...
 

@rcrsn51, et al. -- the launcher project is on hold until I feel like going back to it. It will eventually get more attention, but that's going to be awhile. Why? Basically I lost interest.

----------

Running X-Slacko 1.1 with the new PetGet patch (THANK YOU rg66!!) Wanted MIDI playback. So I installed Audacious (which I would've anyways, since I like the interface) and ****ed around with FluidSynth until I could get what I wanted.

Problem: fluidsynth doesn't start automatically. So I made a shell script to do that, and stuck it in /root/Startup, but it doesn't /stay/ running once the shell script does its thing, and I'm not quite sure why. A simple symlink to /usr/bin/fluidsynth won't work here -- I have to load the soundfont I'm using (at /root/my-documents/chorium.sf2) as well.

Here's my very simple shell script -- how do I make it work as needed?

Code:
#!/bin/sh
fluidsynth /root/my-documents/chorium.sf2


_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
Moose On The Loose


Joined: 24 Feb 2011
Posts: 511

PostPosted: Sun 30 Mar 2014, 16:27    Post subject: Re: Shell script runs OK, but needs to keep going and doesn't...
Subject description: Fluidsynth troubles...
 

starhawk wrote:

Code:
#!/bin/sh
fluidsynth /root/my-documents/chorium.sf2



I think you want a "&" on the end of the statement. Try this silly script to see how putting a statement into a different shell works.

Code:

#!/bin/bash

for AA in 1 2 3 ; do
  Xdialog --yesno "are you bored yet" 0 0
  done &
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 2778
Location: Everybody knows this is nowhere...

PostPosted: Sun 30 Mar 2014, 16:32    Post subject:  

Code:
#!/bin/sh
fluidsynth /root/my-documents/chorium.sf2 &


...does not work Sad

_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2226

PostPosted: Mon 31 Mar 2014, 01:54    Post subject:  

Code:
#!/bin/sh
exec fluidsynth /root/my-documents/chorium.sf2
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 2778
Location: Everybody knows this is nowhere...

PostPosted: Mon 31 Mar 2014, 12:26    Post subject:  

That worked! I'm gonna have to do man exec now, since I've never really become familiar with that command... I'd love to know why it worked.

FWIW, my local guru (who I'd also asked) recommended the nohup command, which I found interesting, considering it's more for telecom stuff than anything else, IIRC.

_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2226

PostPosted: Mon 31 Mar 2014, 13:56    Post subject:  

nohup and exec are both bash builtins, so to get help you need to run(from bash shell):
help exec
help nohup
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 2778
Location: Everybody knows this is nowhere...

PostPosted: Mon 31 Mar 2014, 14:43    Post subject:  

I tend to run man in a browser, at a google search page... Wink
_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2226

PostPosted: Tue 01 Apr 2014, 02:57    Post subject:  

man is used for help for named programs. Since nohup and exec are from bash, then you'd need 'man bash'. But, the bash manpage is epic in length, so the built in help will get you there faster. The distinction is significant. for instance, there is a program called '['. But, when you use '[' in a script or command-line, the *program* '[' is not used. Insetad, bash or other shell will use its' builtin version.
You can see the difference by running 'man [' and then running from shell 'help ['. You can find out which is really being used by running 'type [' which will show that it is a builtin. Whereas, running 'which [' will show /usr/bin/[. If you compare the man page with the internal help you will quickly see that they are not the same program.

nohup means 'no hangup'. Since you are running the script from a terminal, when you close the terminal it kills the process which you backgrounded (with &).
exec replaces the old process (the terminal) with the new process (fluidsynth).

exec is commonly used, but 'nohup fluidsynth ... &' would also work in this case.
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 2778
Location: Everybody knows this is nowhere...

PostPosted: Mon 19 May 2014, 22:50    Post subject:  

...now it doesn't work! AAAAAARGH. (I have replaced my savefile between then and now.)

Code:
#!/bin/sh
exec fluidsynth /root/my-documents/chorium.sf2


...is the entire contents of the file. If I "run in terminal" it works, until I close the terminal window.

Back to square one!

_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4292

PostPosted: Tue 20 May 2014, 01:12    Post subject:  

it may need a tty
rxvt -e "command here"
you can add parameters to make rxvt small or invisible

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3956
Location: Kiel,Germany

PostPosted: Tue 20 May 2014, 09:18    Post subject:  

Errors from

/usr/sbin/delayedrun
and
/root/.xinitrc

usually got to /tmp/xerrs.log
.


If you have fluidsync in a non-standard PATH
like
/usr/music/bin

but altered .bashrc to add /usr/music/bin to the PATH , then
bash
will recognize the PATH,
but
sh
probably not .

That may be the difference when code runs from terminal but not from a script .
Back to top
View user's profile Send private message Visit poster's website 
starhawk

Joined: 22 Nov 2010
Posts: 2778
Location: Everybody knows this is nowhere...

PostPosted: Tue 20 May 2014, 15:00    Post subject:  

@techno -- it didn't need a tty before... it "just worked".
@Karl -- Fluidsynth is in /usr/bin and it has two libs in /usr/lib. xerrs.log doesn't reveal any secrets -- at least, not to me. It clearly runs... but for some reason it doesn't /stay/ running.

_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3956
Location: Kiel,Germany

PostPosted: Tue 20 May 2014, 15:27    Post subject:  

Quote:
If you also want to
deactivate the use of the shell, start FluidSynth with the -i option:
'fluidsynth -ni soundfont.sf2 midifile1.mid midifile2.mid'

http://www.manualpages.de/FreeBSD/FreeBSD-ports-9.0-RELEASE/man1/fluidsynth.1.html

Then /etc/init.d/10_alsa needs to finish plus the loading of drivers .

Puppy forks the loading of drivers using UDEV and /etc/rc.d/rc.servuces start & script .

When you are "unlucky" 10_alsa or loading of kernel modules might not have been finished when
X is already running .


But I suspect the shell option of fluidsynth .

Once FluidSynth is running, it reads commands
from the stdin

-i, --no-shell
Don't read commands from the shell [default = yes]
Back to top
View user's profile Send private message Visit poster's website 
starhawk

Joined: 22 Nov 2010
Posts: 2778
Location: Everybody knows this is nowhere...

PostPosted: Tue 20 May 2014, 16:28    Post subject:  

Added the -i, didn't fix Sad
_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3956
Location: Kiel,Germany

PostPosted: Tue 20 May 2014, 17:50    Post subject:  

Have compiled v1.1.5 - had to disable jack for jack_free missing in libjack*

This is what I get in terminal :

bash-3.00# fluidsynth -i -a alsa /root/Downloads/test/usr/share/sounds/sf2/FluidR3_GS.sf2
FluidSynth version 1.1.5
Copyright (C) 2000-2011 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
fluidsynth: warning: No preset found on channel 0 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 1 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 2 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 3 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 4 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 5 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 6 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 7 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 8 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 9 [bank=128 prog=0]
fluidsynth: warning: No preset found on channel 10 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 11 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 12 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 13 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 14 [bank=0 prog=0]
fluidsynth: warning: No preset found on channel 15 [bank=0 prog=0]
fluidsynth: warning: Requested a period size of 64, got 940 instead
fluidsynth: warning: Requested 16 periods, got 8 instead
bash-3.00#



bash-3.00# ps | grep fluid
2034 root 1:42 /usr/local/bin/fluidsynth
12300 root 0:00 man fluidsynth

Seems to run though ....

Just don't know what it is supposed to do
and what the soundfont does .
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 2 [22 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0821s ][ Queries: 11 (0.0046s) ][ GZIP on ]