Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: TaoTePuh on August 15, 2010, 01:16:29 PM
-
1.) mysqld starts automatically
Why does mysql start automatically after it is loaded? This happens while booting but before mydata.tgz is restored. This daemon is not useful in this form.
Okay, I can fix this in the bootlocal
mysqladmin --user=root shutdown
sudo /usr/local/bin/mysqld_multi start 1
but I wonder if I did not understand the trick? Presumably, it only makes sense if one has made /usr/local/var/mysql/ persistent.
2.) backup/shutdown strategy
I wonder how I can shut down the computer safely and without data loss in processes such as mysql, apache ...
An entry in the file /opt/bootlocal.sh like :
apachectl -k stop
mysqladmin --user=root --password=PASSWORD shutdown
does not make sense, since it is performed only after the backup.
Is there a script that runs before the backup and where can I stop processes like apache, mysql ... and sync the filesystem?
Tao
-
mysqld starts automatically
I'm not at a tc machine at the moment, but this is probably due to a start-up script. Have a look in /usr/local/tc.installed/mysql to see if it is a script.
-
Yes, the script is there and it starts mysqld, but IMHO it starts mysqld too early (before mydata.tgz was restored).
-
/opt/shutdown.sh is for user commands on shutdown [ edit: when activated via the gui, or via exitcheck.sh from the cli ]. Syncing happens as a part of a normal shutdown.
-
The script shutdown.sh will start after the backup :
sync / backup
exec /opt/shutdown.sh
shutdown system
If in the time between backup and shutdown are still open connections (mysql, apache), the data are gone.
The strategy should also be
stop processes (daemons)
sync / backup
exec /opt/shutdown.sh
shutdown
But how automate this? I have not found a script that runs before the backup.
-
Yes, the script is there and it starts mysqld, but IMHO it starts mysqld too early (before mydata.tgz was restored).
As a quick fix you could edit the extension and start the daemon via bootlocal.sh
-
I assume you're shutting down from the gui? You could just remove the backup tick (edit .profile to make it persist), and have backup happen in shutdown.sh after your daemons have shut down.
#!/bin/sh
# put user shutdown commands here
apachectl -k stop
mysqladmin --user=root --password=PASSWORD shutdown
sync
filetool.sh backup noprompt
# If no backup of home was done then loop through valid users to clean up.
...
As a side note, it's an interesting choice to keep the web data and database in ram instead of storage. I suppose longer boot and shutdown, and the size limit are acceptable for the much better performance.
-
@Juanito
As a quick fix you could edit the extension and start the daemon via bootlocal.sh
I have been thinking about it already. But then I did the following simple solution:
/opt/bootlocal.sh :
mysqladmin --user=root shutdown
sudo /usr/local/bin/mysqld_multi start 1
@curaga
You could just remove the backup tick (edit .profile to make it persist), and have backup happen in shutdown.sh after your daemons have shut down.
Chapeau!
A very smart idea ... und there is my tiny SysVinit 0/6 ...
As a side note, it's an interesting choice to keep the web data and database in ram instead of storage. I suppose longer boot and shutdown, and the size limit are acceptable for the much better performance.
I need apache and mysql really only for a mpd/ampache installation. It runs very well in RAM on a Pentium M 850MHz and the backup does not take long (ampache ~ 2MB).
But after I had 30.000+ files indexed ... oops ... /usr/local/var/mysql in now persistent ...