Useful commands for Administration


Backend Log - Show last 15 entries and track and real time:

cat <COYO_DATA_STORAGE>/backend/logs/coyo-backend.log -f tail -15


Directory size - Show folder sizes in the current directory and sort in descending order:

ls | xargs -I {} du -shx {} | sort -rh

Aliases – Aliases are abbreviations for longer commands that you can create yourself. These are configured in the file .bashrc in the respective user directory. 
A Bash alias has the following structure:

alias [alias_name]=\"[command_to_alias]\"

Here are a few aliases from us, simply copy these into the file:

db-connect - a direct connection from the Docker host to the PostgreSQL database:

alias db-connect='docker exec -it $(docker ps | grep db_1 | cut -d\" \" -f1) psql --username=<COYO_DB_USER> <COYO_DB_NAME>'

backend-log - Shows and tracks the last 15 entries from the backend log:

alias backend-log='docker logs -f $(docker ps | grep backend_1 | cut -d\" \" -f1) --tail 15'

dirsize - Lists all folders and their size in the current directory and sorts them in descending order:

alias dirsize='ls | xargs -I {} du -shx {} | sort -rh'

After saving and closing the file, you only need to execute the following commands for your aliases to be executed:

source .bashrc

<>PostgreSQL Database

Output as CSV - Create output of (command) as .CSV in /tmp. (PSQL command must be in the brackets)

copy (command) To '/tmp/psqlexport.csv' With CSV DELIMITER ',' ;

API curls

Postman is a good tool for API requests.

Index Refresh - Starts indexing

curl -X POST https://&lt;COYO_BACKEND_URL&gt;/manage/backend/index/refresh \\
-H 'Content-Type: application/json' \\
-d '{
\"update\": true,
\"delete\": true

Index Refresh Status - Shows the current status of the Index Refresh 

curl -X GET https://&lt;COYO_BACKEND_URL&gt;/manage/index/status \\

Create backup 

curl -X PUT https://&lt;COYO_BACKEND_URL&gt;:8083/api/backups \\

Backup Status - Shows the status of the backup process and when the last backup was created

curl -X GET https://&lt;COYO_BACKEND_URL&gt;:8083/api/backups \\

Was this article helpful?