The "ping" command has disappeared on a server

On a server, when sending “ping” to an application as .my_app/bin/my_app ping, it replies with:

The known commands are:

start          Starts the system
start_iex      Starts the system with IEx attached
daemon         Starts the system as a daemon
daemon_iex     Starts the system as a daemon with IEx attached
eval "EXPR"    Executes the given expression on a new, non-booted system
rpc "EXPR"     Executes the given expression remotely on the running system
remote         Connects to the running system via a remote shell
restart        Restarts the running system via a remote command
stop           Stops the running system via a remote command
pid            Prints the operating system PID of the running system via a remote command
version        Prints the release name and version to be booted

ERROR: Unknown command ping

I’ve built it manually on a server, via mix, therefore I might’ve forgotten to pass some settings to it, during compiliation or launch.

Where have “ping” gone to?

As far as I know, there never was a ping subcommand fir mix-releases, though distillery had one… Did you perhaps accidentally update your elixir from <1.9 to >=1.9 in the process?

Elixir 1.10.

How does it relate to “ping”?

As I said, mix-releases never did now about ping, though distillery releases do.

Therefore, what version of elixir did you use before? Do you have distillery in your deps? If yes, what version constraint did you provide and what is in the mix.lock?

How can one remember the version of every dependency!?

For past versions, history of your VCS, CI or documentation.

For current the current lock file.

Though the important thing right now is, did you use distillery before and “accidentally” upgraded to mix releases?

You should know if the project was built and released using distillery previously. And if you are not sure, take a look at your mix.exs deps/0. If there is :distillery listed, please tell us what constraints are there, and also tell us what version is pinned through the mix.lock.

Also check your history, if there perhaps has work happened by the team to remove distillery.

2 Likes

As a work around, you could use the mix ‘remote’ command. If you it succeeds, you know that your server is running.

I want to also automate it, to be able to call it via a bash script, and a script would return something similar to this:

    ./check_if_online.sh
    ===> it is running
    # or 
    ===> it is not running

How can I get the result of “./bin/my_app remote” and map it to “online” or “offline”?

“remote” doesn’t return any value.

Check the exit code.

I guess that it will be non-zero if the remote was unreachable.

I have to add, instead of tinkering around the issue of the missing ping subcommand, you really should find out why it was there earlier but not now.

Accidental swaps from distillery to mix-releases can cause more issues than just some subcommand vanishing or changing.

If it is not distillery vs. mix release, then you might have some other problem, which we really would like to help you figure out.

1 Like

In order to talk about problems, you have to be aware of my situation. Are you?

I do not know anything about your environment, that is exactly why I have asked you some questions that would allow us to learn something about the issue and narrow the culprits down.

But indeed, we do not know much about your problem, as you did not really answer any of the questions that would enable us to help you.