[Cheatsheet] HealthCheck Alias For Unix

Hi All,

Most of us are unix users since passbolt is always installed on a unix environment.

I really got tired of typing out the following to do a health check;

su - www-data -s /bin/bash -c "/usr/share/php/passbolt/bin/cake passbolt healthcheck"

So I created an alias to make life a little bit easier.
To create an alias simply open up the .bashrc file located in your home directory. You could use the following and open it no matter what directory you are in.

nano ~/.bashrc

Once opened, go right to the bottom of the page and add the following.

alias healthCheck='su - www-data -s /bin/bash -c "/usr/share/php/passbolt/bin/cake passbolt healthcheck"'

Once that is done, source the newly updated .bashrc

source ~/.bashrc

Now you will be able to simply type healthCheck and run the health check without having to type out everything :slight_smile: .

Enjoy the cheat alias,
Bond

2 Likes

I am also bored to type this command as well :slight_smile: This post is a good idea.

On my side, I created a passbolt bash function in my ~/.bashrc:

passbolt () { 
  sudo su - www-data -s /bin/bash -c "/usr/share/php/passbolt/bin/cake $(echo $@)"; 
}

It is a shorcut to the ./bin/cake shell script.

You can use it like this:

# Healthcheck
$ passbolt passbolt healthcheck
# Datacheck
$ passbolt passbolt datacheck --hide-success-details
# Clear cache
$ passbolt cache clear_all
# Database migration status
$ passbolt migration status

You can use the --help flag:

$ passbolt passbolt migrate --help
Migration shell for the Passbolt application.

Usage:
cake passbolt migrate [--backup] [-d default|test] [-h] [--no-clear-cache] [-q] [-v]

Options:

--backup              Make a database backup to be used in case
                      something goes wrong.
--datasource, -d      Datasource name. (default:
                      default) (choices:
                      default|test)
--help, -h            Display this help.
--no-clear-cache      Don't clear the cache once the migration is
                      completed.
--quiet, -q           Enable quiet output.
--verbose, -v         Enable verbose output.

Call passbolt alone to see all available commands:

$ passbolt
No command provided. Choose one of the available commands.

Current Paths:

* app:  src/
* root: /usr/share/php/passbolt/
* core: /usr/share/php/passbolt/vendor/cakephp/cakephp/

Available Commands:

App:
 - console
 - help
 - passbolt
 - passbolt avatar_transfer
 - passbolt cleanup
 - passbolt datacheck
 - passbolt drop_tables
 - passbolt healthcheck
 - passbolt install
 - passbolt keyring_init
 - passbolt migrate
 - passbolt migrate_postgres
 - passbolt mysql_export
 - passbolt mysql_import
 - passbolt register_user
 - passbolt send_test_email
 - passbolt show_logs_path
 - passbolt version

CakePHP:
 - cache clear
 - cache clear_all
 - cache list
 - completion
 - i18n
 - i18n extract
 - i18n init
 - plugin assets copy
 - plugin assets remove
 - plugin assets symlink
 - plugin load
 - plugin loaded
 - plugin unload
 - routes
 - routes check
 - routes generate
 - schema_cache build
 - schema_cache clear
 - server
 - version

EmailQueue:
 - preview
 - sender

Migrations:
 - migrations
 - migrations create
 - migrations dump
 - migrations mark_migrated
 - migrations migrate
 - migrations orm-cache-build
 - migrations orm-cache-clear
 - migrations rollback
 - migrations seed
 - migrations status

Passbolt/EmailDigest:
 - passbolt email_digest preview
 - passbolt email_digest send

Passbolt/JwtAuthentication:
 - passbolt create_access_token
 - passbolt create_jwt_keys

To run a command, type `cake command_name [args|options]`
To get help on a specific command, type `cake command_name --help`
3 Likes

Hi @AnatomicJC,

You Sir, have taken boredom to another level and I like it :joy:

I think your version is much better, you can use the all the cake commands instead of just the health check. I like it a lot.

Thank You for sharing your cheatsheet :slight_smile:

Regards,
Bond

1 Like