Search code examples
linuxsshredhat

'dzdo: service: command not found' when starting a service via SSH


In my gitlab script I'm trying to install and start a java application remotely. The installation part goes fine but when I'm trying to start the service using this command:

ssh $DEPLOY_USER@$DEPLOY_HOST "sudo service my-service start"

I get the next error:

dzdo: service: command not found

All the previous commands with sudo rights are executed successfully. What's wrong with this one?


Solution

  • Adding bash to the command solved the issue:

    ssh $DEPLOY_USER@$DEPLOY_HOST "sudo bash service my-service start"