Command-Line Tools
This page describes the command-line tools of Centova Cast. You use them in a shell on the server, as the root
user. The tools are in the sbin directory of the Centova Cast installation:
castctl- manages the installation: the administrator password, the databases, the streaming software and the repair of damaged data.userctl- manages accounts and their streams.importv3- imports the data of a Centova Cast v3 installation.install- installs, upgrades and reinstalls the packages of streaming software.fixperms- sets the correct owners and permissions of the Centova Cast files.updatecastpath- updates the service files after you move Centova Cast to a different directory.
castctl, userctl and importv3 are symbolic links to the Centova Cast daemon program, bin/castd. The name of
the link selects the tool. All three tools refuse to run if you are not root. They show the message
Permission denied (must be root).
For the removal of Centova Cast, see the Uninstalling section.
Common Options
castctl, userctl and importv3 accept these options. Type them before the command name. For example:
/usr/local/centovacast/sbin/castctl --verbose repair
--help,-h
Shows the usage of the tool, then stops. After a command name, it shows the usage of that command. For example,castctl repair --help.--version
Shows the version number of Centova Cast, then stops.--path=PATH,-r PATH
Specifies the installation directory of Centova Cast. The default is/usr/local/centovacast.--conf=FILE,-c FILE
Specifies the configuration file. A relative path is relative to the installation directory. The default isetc/castd.conf.--quiet,-q
Shows only error messages. This is the same as--verbosity ERROR.--verbose,-v
Shows more messages. This is the same as--verbosity VERBOSE.--verbosity=LEVEL
Sets the quantity of messages that the tool shows on the screen.LEVELis a number from 0 to 7, or one of these names, from the fewest messages to the most:SILENT,ERROR,WARN,INFO,VERBOSE,DEBUG,TRACE.--log=PATHNAME
Also writes the messages to the filePATHNAME.--log-level=LEVEL
Sets the quantity of messages in the file of the--logoption. The values are the same as for--verbosity.--log-text
Writes the file of the--logoption as plain text. The default is a structured format with one JSON object on each line.--color
Shows colors also when the output does not go to a terminal.--no-color
Shows no colors on a terminal.--cpuprofile=FILE,--memprofile=FILE
Write data about the use of the processor or of the memory toFILE. These options are only for the analysis of problems with Centova Technologies support.
castctl
castctl manages the Centova Cast installation. The general form is:
/usr/local/centovacast/sbin/castctl [OPTIONS] COMMAND [COMMAND OPTIONS]
castctl adminpassword
Sets a new password for the admin account. Use this command if you cannot log in to the control panel as the
administrator.
/usr/local/centovacast/sbin/castctl adminpassword
The command asks for the new password two times. The password must have a minimum of 8 characters. If a password is
too short, the command asks again. If the two passwords are not the same, the command shows
passwords do not match and does not change the password. To stop without a change, press Enter at the first
question.
When the change is complete, the command shows Password changed successfully. The command has no options.
Note that this command does not apply the password rules of the control panel. It accepts a password that the control panel refuses. Use a strong password.
You can also give the password through standard input, for example in a script. Give the password two times, each on its own line:
printf '%s\n%s\n' "$NEWPASS" "$NEWPASS" | /usr/local/centovacast/sbin/castctl adminpassword
castctl upgrade
Updates the databases of Centova Cast to the format of the installed version. The upgrade procedure of Centova Cast runs this command automatically. You use it yourself only if Centova Technologies support tells you to.
/usr/local/centovacast/sbin/castctl upgrade
The command does these steps:
- It updates the configuration file. It shows
Updating configuration:and the result. - It updates the master database. It shows
Upgrading master database:and the result. - It updates the databases of each client account. For each account, it shows
Upgrading USERNAME:and the result. It also writes the fallback playlist of the autoDJ again, if the account has one. - It shows the number of updated accounts and the number of errors.
If the update of an account fails, the command continues with the next account. At the end, the command stops with an error status. Correct the problem, then run the command again. The command changes only the databases that are not yet up to date. You can run it again as many times as necessary.
The command has no options.
castctl register
Tells Centova Cast where the program of a streaming software package is. The package installer (sbin/install)
runs this command automatically. You use it yourself only if you installed a streaming server or an autoDJ program
without the package installer, for example if you compiled it yourself.
/usr/local/centovacast/sbin/castctl register --package=NAME --pathname=PATHNAME --package-config=CONF
--package=NAME
Specifies the package name. The names areicecast,shoutcast2,mediamtx,centovasrc,liquidsoapandicescc. This option is required.--pathname=PATHNAME
Specifies the full path of the program file. The file must exist and must be executable. This option is required.--package-config=CONF
Specifies the version of the program and the capabilities that Centova Cast must know. The value starts withvand the version number, for examplev2.4.4. Some packages add more data after a comma. This option is required. If the value is empty or does not start withv, the command showsinvalid package registrationand changes nothing.
The command writes the path of the program to the binaries block of castd.conf, and records the version in the
database. Then it stops.
Each package installs a script that detects the correct --package-config value. The script is
var/lib/pkgconf/NAME in the installation directory. It shows a line that starts with CONF=. Use the text after
CONF= as the value.
Example: You compiled Icecast yourself and installed it as /opt/icecast/bin/icecast. You installed the
icecast package before, so the detection script exists. To register your program:
Run the detection script with the path of the program:
~~~ {.bash} /usr/local/centovacast/var/lib/pkgconf/icecast /opt/icecast/bin/icecast ~~~
The script shows, for example,
CONF=v2.4.4.Register the program with this value:
~~~ {.bash} /usr/local/centovacast/sbin/castctl register --package=icecast --pathname=/opt/icecast/bin/icecast --package-config=v2.4.4 ~~~
Tell Centova Cast to read the new configuration:
~~~ {.bash} systemctl reload cc-castd ~~~
Note that the streaming software runs in a restricted environment. The path of the program must be in a directory that the systemd unit file of Centova Cast permits.
castctl repair
Finds and corrects damaged data in the databases and in the account directories. Use this command after a hardware failure, after a restore of files from a backup, or if Centova Cast support tells you to.
/usr/local/centovacast/sbin/castctl repair [OPTIONS]
Without --fix, the command only reports the problems and the recommended fixes. It changes nothing. Always run the
command without --fix first, and read the report.
The command examines these items:
- The master database: each account must have its records of the correct type, a valid owner, a hostname and a directory. The administrator account must exist.
- The account directories: each directory in
var/vhostsmust belong to an account. - The database of each client account: the file must exist and be readable, and its data must agree with the master database.
- The directory tree of each client account: the directories, the symbolic links of the Icecast web directory and the file permissions.
The command cannot run while Centova Cast runs, because it needs exclusive use of the master database. Stop Centova Cast first:
systemctl stop centovacast
/usr/local/centovacast/sbin/castctl repair
/usr/local/centovacast/sbin/castctl repair --fix
systemctl start centovacast
The options are:
--fix
Applies the recommended fixes. Before the first change, the command makes a copy of the master database. The name of the copy is the name of the database file followed by.backupand the date and time, for example.backup20261121153000. It also copies the database of each client account before it changes it.--no-remove
Does not remove accounts that the command cannot repair. Without this option,--fixremoves these accounts.--no-backup
Does not copy the databases before the changes.--ignore-extra-dirs
Does not report directories invar/vhoststhat do not belong to an account.--db-cleanup-only
Examines only the databases, not the configuration files and the directories of the accounts. This option also sets--ignore-extra-dirs.--skip-vhosts
Examines only the master database, not the client accounts.--fix-permissions
Sets the file permissions of every account again. Without this option, the command sets the permissions of an account only if it repaired the directory tree of that account. This option can take a long time on a server with many media files.--force
Runs also when Centova Cast or another repair runs.--json
Writes the report as JSON to standard output, for use in a script.
WARNING: Do not use --force while Centova Cast runs. Centova Cast and the repair can then change the same data at
the same time and damage it.
CAUTION: Before you use --fix, read the report of the problems. Without --no-remove, --fix permanently removes
each account that the command cannot repair, with all of its files.
If the administrator account does not exist, --fix creates it again with a random password. The command shows the
password at the end of its output. The password is not recorded anywhere else. Change it with
castctl adminpassword.
If a directory in var/vhosts does not belong to an account, but contains the configuration files of a streaming
server and of an autoDJ, --fix creates an account for it again. For other unknown directories, the report tells you
to examine the directory and to remove it yourself.
When a --fix run leaves problems that it could not repair, the command stops with an error status and shows the
number of these problems.
castctl metrics
Shows the contents of a metrics file as comma-separated values (CSV). Centova Cast keeps the listener metrics of each
client account in var/vhosts/USERNAME/var/lib/metrics/metrics.ccvs, and the metrics of the server in
var/lib/db/metrics.ccvs.
/usr/local/centovacast/sbin/castctl metrics
FILENAME
Specifies the metrics file. This argument is required.--header
Shows the header data of the file instead of the contents: the format version and the first and last times in the file.
Each line of the output is one listener session. The first line names the columns: start, end, ipaddress,
country, duration, transfer, mountid, agentid and visitorid.
This command only reads the file. You can use it while Centova Cast runs.
castctl settings get
Shows the server settings from the database, in JSON format. These are the settings of the Settings page of the control panel. For more information, see the Settings section.
/usr/local/centovacast/sbin/castctl settings get
This command only reads the database. To change the settings, use the Settings page.
castctl version
Shows the product name, the version number and the build number of Centova Cast, in this form:
Centova Cast VERSION (BUILD)
userctl
userctl manages the accounts and their streams. The general form is:
/usr/local/centovacast/sbin/userctl [OPTIONS] COMMAND [COMMAND OPTIONS]
The start, stop, restart, reload, status and monitor commands send their requests to Centova Cast.
Centova Cast must run when you use them.
Selecting Accounts
The start, stop, restart, reload and status commands accept one of these values for USERNAME:
- A username, for example
stationone. - A list of usernames, separated by commas, with no spaces. For example,
stationone,stationtwo. - A pattern with the wildcard characters
*(any text) and?(any one character). For example,station*selects all of the client accounts with a username that starts withstation. Put the pattern in quotes, so that the shell does not expand it. A pattern selects only client accounts.
If you give no username, the command shows must specify a username or pattern.
userctl list
Shows all of the accounts on the server, with the columns ID, USERNAME, REAL NAME, EMAIL, TYPE and
STATUS. The list includes the administrator, staff accounts, resellers, clients and DJs.
/usr/local/centovacast/sbin/userctl list
userctl create
Creates a reseller account.
/usr/local/centovacast/sbin/userctl create [--email=EMAIL] [--name=NAME] reseller USERNAME
reseller
Specifies the account type. Onlyreselleris available. The command refuses the typesclient,djandstaff. To create these accounts, use the control panel.USERNAME
Specifies the username of the new account.--email=EMAIL
Specifies the email address of the account.--name=NAME
Specifies the real name of the account.
The command asks for the password of the new account two times. The password must have a minimum of 8 characters.
The command creates the account with the default settings of a new reseller account. When the command is complete,
it shows Created reseller account "USERNAME". To change the other settings of the account, use the control panel.
For more information, see the Reseller Account Settings
section.
userctl authreset
Removes the login bans and the records of failed logins. Use this command if a user cannot log in because Centova
Cast banned the IP address of the user. For more information about bans, see the Login failures setting in the
Settings section.
/usr/local/centovacast/sbin/userctl authreset USERNAME
USERNAME
Removes the recent failed logins to the accountUSERNAME. It also removes the bans of each IP address from which a recent login to this account came. "Recent" means the time in which Centova Cast counts failed logins, from theLogin failuressetting.-
If you type-instead of a username, the command removes all of the bans and all of the recent failed logins on the server.
userctl start
Starts the streaming server of an account, and the autoDJ if the account settings tell Centova Cast to.
/usr/local/centovacast/sbin/userctl start [OPTIONS] USERNAME
Without options, the command starts the autoDJ with the streaming server if the account has autoDJ support and the
Start autoDJ when starting server setting of the account is Yes.
--with-autodj
Also starts the autoDJ, whatever the account setting is.--without-autodj,--server
Starts only the streaming server, whatever the account setting is.--autodj
Starts only the autoDJ. The streaming server must already run.--diagnostic
Starts the streaming server and the autoDJ for some seconds, and shows their output. Use this option to find why a stream does not start. Centova Cast does not record a diagnostic start as the normal state of the stream. The stream does not stay on the air after the test.
The command shows the result for each account. It stops with an error status only if it could not start any of the selected accounts.
userctl stop
Stops the streaming server and the autoDJ of an account.
/usr/local/centovacast/sbin/userctl stop [--autodj] USERNAME
--autodj
Stops only the autoDJ. The streaming server continues to run.
userctl restart
Stops and starts the streaming server and the autoDJ of an account again.
/usr/local/centovacast/sbin/userctl restart [--autodj] USERNAME
--autodj
Restarts only the autoDJ.
userctl reload
Tells the streaming server and the autoDJ of an account to read their configuration again, without a stop. Use this command after a change to the configuration files of the account.
/usr/local/centovacast/sbin/userctl reload [--autodj] USERNAME
--autodj
Reloads only the autoDJ.
userctl status
Shows the status of the selected accounts in a table.
/usr/local/centovacast/sbin/userctl status [--watch=SECONDS] USERNAME
--watch=SECONDS,-w SECONDS
Shows the table again everySECONDSseconds, until you pressCtrl+C.
The table has the columns Username, Item, State, Since, Listeners and Playing. Each account has these
rows:
- The streaming server.
StateisOnlineif the server runs, orOffline.Listenersshows the number of listeners. - The autoDJ, if the account has one.
StateisOn airif the autoDJ sends audio to the server,Onlineif it runs but does not send audio, orOffline. - One row for each mount point.
StateisLiveif a live source sends audio,AutoDJif the autoDJ sends audio, orOffline.Listenersshows the number of listeners and the maximum number of listeners (∞for no limit).Playingshows the current track title.
The Since column shows the time of the last change of the state.
userctl monitor
Shows the activity of one stream in real time, in a full-screen view of the terminal.
/usr/local/centovacast/sbin/userctl monitor USERNAME
USERNAME must be one username. Patterns and lists are not permitted.
The view shows the account settings and resource use at the top, and these panes below:
Notable Activity
Shows the important events of the stream, for example starts, stops and title changes.Server Log
Shows the new lines of the log of the streaming server.Source Log
Shows the new lines of the log of the autoDJ.
Use these keys in the view:
q,EscorCtrl+C- closes the view.c- clears all of the panes.- Up arrow and Down arrow - scroll the panes by one line.
Page UpandPage Downscroll by one page.Homegoes to the oldest line andEndgoes to the newest line. - Left arrow and Right arrow - scroll the panes to the left and to the right.
Ctrl+Leftgoes back to the left edge.
importv3
importv3 imports the data of a Centova Cast v3 installation on the same server into Centova Cast v4. The installer
starts it automatically when you install with the --import-v3 option. You use it yourself to continue an
interrupted import, to roll the import back, or to finalize it. The Installation Manual describes the complete
migration procedure.
When the installer starts a migration, Centova Cast v4 is in the temporary directory /usr/local/centovacast4 until
you finalize the migration. Use the importv3 command of that directory:
/usr/local/centovacast4/sbin/importv3 [OPTIONS]
Without --rollback or --finalize, the command starts or continues the import. The importer records each change
in a journal in var/lib/importv3/ of the Centova Cast v4 directory. If an import stops, run the command again. It
continues from the point where it stopped.
CAUTION: Do not delete the var/lib/importv3/ directory before the migration is finalized. Without the journal, the
importer cannot roll the migration back.
The options are:
--v3-path=PATH
Specifies the directory of Centova Cast v3. The default is the directory that/etc/centovacast.confnames.--v3-url=URL
Specifies the URL of the control panel of Centova Cast v3. The default ishttps://127.0.0.1:2199/.--insecure-tls
Accepts the self-signed certificate of the Centova Cast v3 control panel. This is the default for a URL on the server itself.--password-env=NAME
Reads the password of the Centova Cast v3adminaccount from the environment variableNAME, instead of asking for it.--accounts=USER,USER
Imports only the given Centova Cast v3 accounts. If a client account belongs to a reseller that is not in Centova Cast v4, the importer also imports the reseller.--on-error=POLICY
Specifies what the importer does when the import of an account fails. The options are:prompt
Asks you, with theRetry,SkipandAbortchoices. This is the default. It needs a terminal.skip
Abandons each failed account and continues.abort
Rolls the import back at the first failure.retry-once
Tries each failed account once more, then abandons it if it fails again.
--accept-conflicts
Accepts all conflicts without a question: new ports for an account, and conversions to a different stream format. Without a terminal, the importer refuses all conflicts unless you give this option.--backup-timeout=DURATION
Specifies the maximum time for the backup of one account in Centova Cast v3, for example45m. The default is30m.--minimize-downtime
Keeps the Centova Cast v3 streams on the air until you finalize. If you started the import with this option, give it again when you continue the import. The importer refuses to continue in a different mode.--dry-run
Makes the checks and shows what the import will do, but changes nothing.--no-tui
Writes plain text output, also on a terminal.--yes
Answers yes to every confirmation question.--restart
Keeps the journal of an earlier import under a new name, and starts a new import. The importer asks for your approval first. If the earlier import changed data, you must roll it back before you use this option. You cannot use this option after a finalize, or with--dry-run.--rollback
Rolls the migration back. For each imported account, the importer stops and disables the account in Centova Cast v4, starts the stream in Centova Cast v3 again if the import stopped it, and deletes the backup files that the import made. It also makes the login page of Centova Cast v3 available again. If a finalize is in progress, the importer undoes the finalize first. A rollback continues after a failed step, and reports the failures at the end.--finalize
Finalizes the migration. The importer stops Centova Cast v3 and moves it aside. It moves Centova Cast v4 to its final directory, and gives it the web ports of Centova Cast v3.--final-path=PATH
With--finalizeonly: specifies the final directory of Centova Cast v4. The default is the directory that you gave to the installer with--base-path, or/usr/local/centovacast.--final-ports=HTTP,HTTPS
With--finalizeonly: specifies the final HTTP and HTTPS ports of the control panel. Centova Cast v4 also uses ports 2197 and 2199. The default is the ports that you gave to the installer.--force-finalize
With--finalizeonly: finalizes also when the journal does not show a complete import.CAUTION: Do not use
--force-finalizeunless the import is complete. Finalize retires Centova Cast v3, and accounts that are not imported are then not in service.
You cannot use --rollback and --finalize together, or with the import options.
Example: An import stopped because of a power failure. The administrator started it with
--minimize-downtime. To continue the import, then finalize it:
/usr/local/centovacast4/sbin/importv3 --minimize-downtime
/usr/local/centovacast4/sbin/importv3 --finalize
Package Installer
The package installer, sbin/install, installs the streaming servers, the autoDJ programs and other optional
software. It downloads the package from Centova Technologies, installs it, registers it with castctl register, and
tells Centova Cast to read its configuration again. You do not restart Centova Cast.
/usr/local/centovacast/sbin/install PACKAGE [OPTIONS]
The package name must come first, before the options. To show the help text, type a package name followed by
--help, for example sbin/install icecast --help.
The packages are:
icecast- the Icecast streaming server.shoutcast2- the Shoutcast 2 streaming server.mediamtx- the MediaMTX streaming server.centovasrc- Centova Source, the autoDJ program of Centova Cast.liquidsoap- the Liquidsoap autoDJ program.icescc- the ices-cc autoDJ program.lego- the lego ACME client, for certificates for wildcard hostnames. For more information, see the TLS Certificates section.
The options are:
--force
Downloads the latest version of the package again and installs it, also if this version is already installed. The package installer first removes the copies of the package in its download cache.--channel=NAME
Specifies the release channel:stableorunstable. The default is the release channel of the Centova Cast installation.--arch=ARCH
Uses the packages for the architectureARCH(i686orx86_64) instead of the detected architecture.--dist=DIST
Uses the packages for the Linux distribution typeDIST(debianorredhat) instead of the detected distribution.redhatincludes CentOS Stream, Rocky Linux and AlmaLinux.--no-color
Shows no colors.--help,-h
Shows the help text.
If the package is not installed, the package installer installs it and shows Installation Complete. If the package
is installed and a newer version is available, it installs the newer version and shows Upgrade Complete. If the
installed version is the latest version, it shows Already Installed and changes nothing.
Only one package installation can run at a time. If another package installation is in progress, the package
installer stops with the message Another package installation job appears to already be in progress.
The package installer needs the license key in castd.conf. If there is no license key, it stops with the message
A license key has not been installed.
fixperms
fixperms sets the correct owners and permissions of all of the files and directories of Centova Cast. Centova Cast
operates correctly only if its files have the correct owners and permissions. It also makes the standard directories
of the installation and of each account again, if they are missing.
/usr/local/centovacast/sbin/fixperms [--root=PATH]
Run this command if a person or a program changed the owners or the permissions of the Centova Cast files, for
example with chown or chmod. The installer and the package installer also run it.
The command refuses to run if you are not root. Its message ends with must be run as root.
The option is:
--root=PATH
Specifies the directory of the Centova Cast files to correct. The default is the installation directory that/etc/centovacast.confnames, or/usr/local/centovacastif that file names none. This option must be the first argument. IfPATHhas nosbindirectory, the command stops with the messageInvalid root path: PATH.
You can add your own scripts to fixperms:
sbin/prefixperms
If this file exists in the installation directory and is executable,fixpermsruns it first. If it stops with an error,fixpermsstops with the messagePre-fixperms script exited with error, aborting updateand changes nothing.sbin/postfixperms
If this file exists in the installation directory and is executable,fixpermsruns it last.
updatecastpath
updatecastpath writes the service files of Centova Cast again for the installation directory that
/etc/centovacast.conf names. The service files are the only installed files that contain the installation
directory. All of the other files find it when Centova Cast runs.
/usr/local/centovacast/sbin/updatecastpath [--restart]
Run this command after you move Centova Cast to a different directory and change CASTPATH in
/etc/centovacast.conf to the new directory. Use the updatecastpath command in the new directory.
The command does these steps:
- It writes the systemd unit files in
lib/systemd/of the installation directory again. - If the server uses systemd, it installs the unit files in systemd. If the server uses sysvinit and
/etc/init.d/centovacastexists, it copies the init script to/etc/init.d/centovacast. - If the
/etc/cron.ddirectory exists, it installs the cron job of Centova Cast in/etc/cron.d/centovacast-v4. - It shows the list of the files that it wrote.
The command stops with an error if /etc/centovacast.conf names a directory that does not contain Centova Cast. It
also stops if that directory is not the directory of the command itself. In that case, correct CASTPATH and run
the command again. The command refuses to run if you are not root.
The options are:
--restart
Restarts the Centova Cast services after the update. Without this option, the command shows the command line to restart Centova Cast from its new directory.--help,-h
Shows the help text.