aristosv
Posts: 159
Joined: Mon Dec 08, 2014 7:47 pm

command execution issue

Fri Dec 12, 2014 11:48 am

I am running a script on boot (on boot.sh) that performs 2 commands.

Code: Select all

/usr/bin/mpg123 -Z -q /root/music/*
cp test.sh /root
My problem is that the file is not getting copied because the first command will not let the second command get executed.

How can I fix this?

DirkS
Posts: 10361
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: command execution issue

Fri Dec 12, 2014 12:12 pm

You can make the first command run in the background by putting an '&' at the end of the command.

Code: Select all

/usr/bin/mpg123 -Z -q /root/music/* &
cp test.sh /root
Alternatively you could run the copy *before* starting the player...

Gr
Dirk.

User avatar
DougieLawson
Posts: 39091
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: command execution issue

Fri Dec 12, 2014 12:16 pm

aristosv wrote:I am running a script on boot (on boot.sh) that performs 2 commands.

Code: Select all

/usr/bin/mpg123 -Z -q /root/music/*
cp test.sh /root

Code: Select all

/usr/bin/mpg123 -Z -q /root/music/* &
cp test.sh /root
add an & to force mpg123 to run in the background.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Raspberry Pi OS”