Scripts¶
There are several scripts to make it easier to use MusicDB. The scripts and how they work are described in the following sections.
All scripts have no command line arguments. The last code examples in each subsection give an impression of what the script internally does.
In the source directory, the scripts described in this chapter can be found in scripts/helper/*.sh
.
When installing MusicDB, they get copied into the server directory that is part of the $PATH
variable.
So the scripts can be executed from anywhere in the shell.
When and how to use these scripts will be shown in the following code example:
# Start all depending processes (once after each operating system reboot)
musicdb-boot.sh
# Start MusicDB itself
musicdb-start.sh
# If you have to restart the server, do the following:
musicdb-stop.sh && musicdb-start.sh
# Stop MusicDB
musicdb-stop.sh
# Stop all depending processes (befor shutting down the whole operating system)
musicdb-shutdown.sh
There are some more scripts in the MusicDB scripts directory that are used for the installation process.
See the Installation & Update documentation to learn about install.sh
and check.sh
.
musicdb-boot¶
This script starts all depending processes that are needed by the server. Only exception is the HTTP server that must be started by the user.
All processes get started with the configuration made for MusicDB. This is done by determine the configuration directory of MusicDB. In this directory, the related configuration files are placed. They are used.
The configuration directory will be determined by checking in which directory the musicdb.ini in /etc is linked to.
So if /etc/musicdb.ini is linked to /data/musicdb/musicdb.ini, then /data/musicdb is the used directory.
In the following text just called $CFGDIR
.
These are the processes that gets started with the annotated configuration:
icecast[2]
with$CFGDIR/icecast/config.xml
Those files and the directory structure should be generated by the installation process.
musicdb-boot
first checks if the processes are already running.
If that is the case, they get killed and restarted.
You need to be root to execute the script. The processes started by this script will run with their own user ID as configured in their configurations.
icecast -b -c $ICECASTCONFIG > /dev/null
musicdb-shutdown¶
Same procedure as musicdb-boot
.
Just instead of starting the processes, they get stopped.
killall icecast > dev/null 2>&1
musicdb-start¶
This scripts starts the MusicDB WebSocket Server.
If the server is already running (determined by the existence of the PID-file), nothing will be done.
The server gets executed with the user ID of the user musicdb
.
This user should be created during the installation process
su -l -c "musicdb server" "musicdb"
musicdb-stop¶
This script stops the MusicDB server. It reads the configuration (/etc/musicdb.ini) to determine the pid-file in which the PID of the MusicDB server is stored. Then the server just gets killed by its PID.
kill $( cat $MUSICDB_PIDFILE )
update¶
This script only updates the files in the server directory. So only a code update will be done.
The script immediately runs the update. It does not ask the user to confirm the auto-detected setup of the installation.
Data updates (like new database schemes) must be done by the developer himself or
use the argument --major
for a major release update.
Then a post-update process gets started that updates the configuration and database schemes.