Command ending with "&" (mysql)

81 views
Skip to first unread message

François Blackburn

unread,
Oct 8, 2014, 9:11:53 PM10/8/14
to al...@googlegroups.com
Hi

I have installed mysql with FFP0.7. All works good, except start on boot.

When I use web interface to enable mysqld (under Services--> users --> FFP or with user script : sh /ffp/start/mysql.sh start), this process freeze on boot. 

Example: After a reboot, there are nothing on web interface after services-->user-->user/ffp (automatic, transmission, minidlna, etc are not loaded) and custom package like sudoer doesn't work.

I think the problem is the "&" in the mysql.sh. I made test and put the command "top &" in user script, same issue.

Am I wrong or  Alt-F doesn't like ampersand (&) ending?

Thanks

João Cardoso

unread,
Oct 9, 2014, 2:07:32 PM10/9/14
to al...@googlegroups.com


On Thursday, October 9, 2014 2:11:53 AM UTC+1, François Blackburn wrote:
Hi

I have installed mysql with FFP0.7. All works good, except start on boot.

When I use web interface to enable mysqld (under Services--> users --> FFP or with user script : sh /ffp/start/mysql.sh start), this process freeze on boot. 

But did it works before a reboot? Or do you need to do something special such as creating needed folders?
I was not able to reproduce this, because I don't know how to setup ffp mysql in the first place.
What happens if you just execute '/ffp/bin/sh /ffp/start/mysql.sh start' from the command line -- will it return? Will the service be kept running and usable?

If you use 'rcffp start' it will run '/ffp/etc/rc start', which is the normal ffp startup, and which runs all executable scripts found at /ffp/start/*.sh.
Alt-F just executes '/ffp/etc/rc start', and waits for it to finish... if it does not finish/returns Alt-F will wait for ever.
In the ffp webUI page each /ffp/start/*.sh executable script is executed with 'status' as its arguments, and the output parsed. If the command never returns, Alt-F will keep wait for it to end.

Unfortunately ffp start/stop scripts don't return an exit value, so the echoed string (running/not running) has to be parsed.



Example: After a reboot, there are nothing on web interface after services-->user-->user/ffp (automatic, transmission, minidlna, etc are not loaded) and custom package like sudoer doesn't work.

I think the problem is the "&" in the mysql.sh. I made test and put the command "top &" in user script, same issue.

Am I wrong or  Alt-F doesn't like ampersand (&) ending?

Don't know.
The '&' should just put the process in the background, returning control to Alt-F and allowing it to continue. On the 'top' example, without a & the top command would never return, waiting for user interaction to finish.

So: make sure that the mysql server is running after you start it; be sure that 'status' says that it is running.
Also be sure that you don't mix Alt-F and ffp binaries -- e.g., writing 'sh blabla' will call Alt-F sh, not ffp sh, and that can make a difference. Be sure that PATH order is right.

If you find the culprit please let me know.



Thanks

François Blackburn

unread,
Oct 14, 2014, 11:45:18 PM10/14/14
to al...@googlegroups.com


Le jeudi 9 octobre 2014 14:07:32 UTC-4, João Cardoso a écrit :


On Thursday, October 9, 2014 2:11:53 AM UTC+1, François Blackburn wrote:
Hi

I have installed mysql with FFP0.7. All works good, except start on boot.

When I use web interface to enable mysqld (under Services--> users --> FFP or with user script : sh /ffp/start/mysql.sh start), this process freeze on boot. 

But did it works before a reboot? Or do you need to do something special such as creating needed folders?
 
Yes it work and yes I need to create special folder. In user script, I execute:

ln -s /mnt/sda2/<PATH>/srv/ /srv;

And about this, I thought that the racine (/) was in flash memory, but when I create a directory in the racine it stay after reboot, why?
 
I was not able to reproduce this, because I don't know how to setup ffp mysql in the first place.
What happens if you just execute '/ffp/bin/sh /ffp/start/mysql.sh start' from the command line -- will it return? Will the service be kept running and usable?
 
Yes everything running. But, if I use this in user script, same problem (freeze).


If you use 'rcffp start' it will run '/ffp/etc/rc start', which is the normal ffp startup, and which runs all executable scripts found at /ffp/start/*.sh.
Alt-F just executes '/ffp/etc/rc start', and waits for it to finish... if it does not finish/returns Alt-F will wait for ever.
In the ffp webUI page each /ffp/start/*.sh executable script is executed with 'status' as its arguments, and the output parsed. If the command never returns, Alt-F will keep wait for it to end.

I think it is the problem, the "sh /ffp/startmysqld start" command 'never' return. I don't know how to explain that but I will try:

$ sudo /ffp/start/mysqld.sh start
$ 141014 22:36:23 mysqld_safe Logging to '/srv/mysql/NYX.err'.
141014 22:36:23 mysqld_safe Starting mysqld daemon with databases from /srv/mysql


As you see, after command start, there are some junk in console about mysqld and it is this that "freeze" ALT-F after reboot.

 

Unfortunately ffp start/stop scripts don't return an exit value, so the echoed string (running/not running) has to be parsed.



Example: After a reboot, there are nothing on web interface after services-->user-->user/ffp (automatic, transmission, minidlna, etc are not loaded) and custom package like sudoer doesn't work.

I think the problem is the "&" in the mysql.sh. I made test and put the command "top &" in user script, same issue.

Am I wrong or  Alt-F doesn't like ampersand (&) ending?

Don't know.
The '&' should just put the process in the background, returning control to Alt-F and allowing it to continue. On the 'top' example, without a & the top command would never return, waiting for user interaction to finish.

There are nothing wrong here, my bad.
 

So: make sure that the mysql server is running after you start it; be sure that 'status' says that it is running.
Also be sure that you don't mix Alt-F and ffp binaries -- e.g., writing 'sh blabla' will call Alt-F sh, not ffp sh, and that can make a difference. Be sure that PATH order is right.

In all my tests, there was no difference, but I will use ffp sh
 

If you find the culprit please let me know.

 As I say above, the problem is mysqld.sh. I have modified this file like this:

mysqld_start()
{
        /ffp/bin/mysqld_safe $mysqld_flags </dev/null &
}

To

mysqld_start()
{
        /ffp/bin/mysqld_safe $mysqld_flags < /dev/null >& /dev/null &
}

And there no freeze after reboot. When I put:
sh /ffp/start/mysqld.sh start;
In user script, everything works good. But when I use ffp-->mysqld check enable (the service start normaly if isn't started and stop normaly if I uncheck), after reboot, the service won't start and it's status say " stopped". 
The log of mysqld:
141013 21:41:44 [Note] /ffp/libexec/mysqld: Normal shutdown

141013 21:41:44 [Note] Event Scheduler: Purging the queue. 0 events
141013 21:41:44 [Note] /ffp/libexec/mysqld: Shutdown complete

141013 21:41:44 mysqld_safe mysqld from pid file /srv/mysql/DLINK.pid ended

For a mysterious reason, the service start and stop immediatly (I presume) (but I don't have log that the service had start, it's weird)

Something else that's weird:

$ sudo /ffp/start/mysqld.sh start
$ sudo /ffp/start/mysqld.sh status
mysqld not running
$ sudo /ffp/start/mysqld.sh restart
WARNING: mysqld: Not running
$ 141014 23:02:50 mysqld_safe Logging to '/srv/mysql/DLINK.err'.
141014 23:02:50 mysqld_safe A mysqld process already exists
$ sudo /ffp/start/mysqld.sh stop
WARNING: mysqld: Not running

But with ALT-F webui, if I uncheck, the service stop propely with no error

ps aux:

 2455 root     {mysqld_safe} /bin/sh /ffp/bin/mysqld_safe --user=root
 2545 root     /ffp/libexec/mysqld --basedir=/ffp --datadir=/srv/mysql --user=root --log-error=/srv/mysql/DLINK.err --pid-file=/srv/mysql/DLINK.pid --socket=/ffp/var/run/mysql/mysql.sock --port=3306
 2546 root     /ffp/libexec/mysqld --basedir=/ffp --datadir=/srv/mysql --user=root --log-error=/srv/mysql/DLINK.err --pid-file=/srv/mysql/DLINK.pid --socket=/ffp/var/run/mysql/mysql.sock --port=3306
 2547 root     /ffp/libexec/mysqld --basedir=/ffp --datadir=/srv/mysql --user=root --log-error=/srv/mysql/DLINK.err --pid-file=/srv/mysql/DLINK.pid --socket=/ffp/var/run/mysql/mysql.sock --port=3306

Did you know why mysqld_safe is in {} ? 

Finaly, with " >/dev/null " added in mysqld.sh and "sh /ffp/start/mysqld.sh start" in user script, all seem to work good 

João Cardoso

unread,
Oct 16, 2014, 11:30:19 AM10/16/14
to al...@googlegroups.com

There are two possible issues here:

1-the Alt-F ffp webUI and the 'rcffp start' initscript which is run at boot
2-the ffp mysql initscript.

I can't help you 2, but here it says:

Now we manually start the MySQL server for further configuration:

sh /ffp/start/mysqld.sh start
Note that you will have to press Enter to get your prompt back (unlike other daemons).

This might explains issue 1, why 'rcffp start' blocks at boot.

As I said, Alt-F just calls the normal ffp scripts:

-at boot time it runs 'rcffp start', which you can run anytime after boot, and which does:
export PATH=$PATH:/ffp/bin:/ffp/sbin
/ffp/etc/rc $1
-to start or stop a given ffp service the webUI goes
PATH=/ffp/bin:/ffp/sbin:$PATH $srv start|stop|status

So, if the ffp mysql initscript has an odd behaviour, different from the other ffp init scripts, you have to fix it first.

Sorry but I can't help you more.

François Blackburn

unread,
Oct 16, 2014, 10:41:20 PM10/16/14
to al...@googlegroups.com

Le jeudi 16 octobre 2014 11:30:19 UTC-4, João Cardoso a écrit :

There are two possible issues here:

1-the Alt-F ffp webUI and the 'rcffp start' initscript which is run at boot
2-the ffp mysql initscript.

I can't help you 2, but here it says:

Now we manually start the MySQL server for further configuration:

sh /ffp/start/mysqld.sh start
Note that you will have to press Enter to get your prompt back (unlike other daemons).

This might explains issue 1, why 'rcffp start' blocks at boot.

Yeah maybe, but Enter is only "to get" prompt back. Otherwise, we can write command without to press Enter before and it works.
Exemple with command top:

    $ sudo /ffp/start/mysqld.sh start
    $ 141014 22:36:23 mysqld_safe Logging to '/srv/mysql/NYX.err'.
141014 22:36:23 mysqld_safe Starting mysqld daemon with databases from /srv/mysqltop<Enter>
 
Anywais, if to add > /dev/null in mysqld.sh solve this problem, that's cool. 


As I said, Alt-F just calls the normal ffp scripts:

-at boot time it runs 'rcffp start', which you can run anytime after boot, and which does:
export PATH=$PATH:/ffp/bin:/ffp/sbin
/ffp/etc/rc $1
-to start or stop a given ffp service the webUI goes
PATH=/ffp/bin:/ffp/sbin:$PATH $srv start|stop|status

So, if the ffp mysql initscript has an odd behaviour, different from the other ffp init scripts, you have to fix it first.

$ sudo /ffp/etc/rc start
$ sudo rcffp start
or what else, everything works good, except on boot. I think the problem is the privileges. Does S98ffp start with root privilege?

I tried to change the second line in S98ffp
TYPE=user
to
TYPE=sys

And it works !!!! So I presume that every service with type=sys start with root privilege?

 
Sorry but I can't help you more.


Don't be sorry, you help me a lot and your firmware is awesome !

João Cardoso

unread,
Oct 17, 2014, 8:29:03 PM10/17/14
to al...@googlegroups.com
?!
 
So I presume that every service with type=sys start with root privilege?

No, that is only for presentation purposes, where in the Services menu the entry (ffp in this case) will it appear (user, system or network).
All initscripts are executed as root, although some of them might start programs under other user name (but the ffp initscript runs as root)

I really don't control ffp, so I have compiled and I'm testing mysql for Alt-F, expect a release soon.
There is a long standing mysql package request http://sourceforge.net/p/alt-f/packagerequest/14/, so it's time to fullfill the request :-)

François Blackburn

unread,
Oct 20, 2014, 3:31:42 PM10/20/14
to al...@googlegroups.com
Oh well, you are absolutly right! I have tried to change back to type=user and it works ... And really don't know why :/

If I discover what was the problem I'll post. Otherwise, it's closed

Thanks

João Cardoso

unread,
Oct 20, 2014, 4:02:09 PM10/20/14
to


On Monday, October 20, 2014 8:31:42 PM UTC+1, François Blackburn wrote:
Oh well, you are absolutly right! I have tried to change back to type=user and it works ... And really don't know why :/

neither me :)

I have uploaded three mysql packages to sourceforge two days ago, try them.
 

If I discover what was the problem I'll post. Otherwise, it's closed

Closed but not solved, as it anybody else has similar issues we don't know how to solve them :-(

François Blackburn

unread,
Oct 20, 2014, 5:14:02 PM10/20/14
to al...@googlegroups.com


Le lundi 20 octobre 2014 16:02:09 UTC-4, João Cardoso a écrit :


On Monday, October 20, 2014 8:31:42 PM UTC+1, François Blackburn wrote:
Oh well, you are absolutly right! I have tried to change back to type=user and it works ... And really don't know why :/

neither me :)

I have uploaded three mysql packages to sourceforge two days ago, try them.

Great !  I just tested and it seems to run good with my XBMC databases :) 

Thanks a lot!

 

If I discover what was the problem I'll post. Otherwise, it's closed

Closed but not solved, as it anybody else has similar issues we don't know how to solve them :-(

I hope it will not happen with your new package.
Reply all
Reply to author
Forward
0 new messages