sudo: start: command not found
Asked by Mark C_ Duncan:

Deploying Bamboo as a service on AWS Linux 2 instance using Terraform with remote-exec provisioner. The start and stop command cannot be found.

Code snippet:  
"sudo touch bamboo.service",  
"echo '\[Unit\]' \| sudo tee -a bamboo.service",  
"echo 'Description=Atlassian Bamboo Agent' \| sudo tee -a bamboo.service",  
"echo 'After=syslog.target network.target' \| sudo tee -a bamboo.service",  
"echo ' ' \| sudo tee -a bamboo.service",  
"echo '\[Service\]' \| sudo tee -a bamboo.service",  
"echo 'Type=forking' \| sudo tee -a bamboo.service",  
"echo 'User=bamboo-agent' \| sudo tee -a bamboo.service",  
"echo 'Group=bamboo-agent' \| sudo tee -a bamboo.service",  
/\*"echo 'Environment=CATALINA_PID=/bamboo-install/atlassian-bamboo-9.6.2/atlassian-bamboo/bin/Catalina.pid' \| sudo tee -a bamboo.service",  
"echo 'PIDFile=/bamboo-install/atlassian/bamboo/bin/Catalina.pid' \| sudo tee -a bamboo.service",\*/  
"echo 'ExecStart=/root/ec2-user/bamboo-install/atlassian-bamboo-9.6.2/bin/start-bamboo.sh start sysd' \| sudo tee -a bamboo.service",  
"echo 'ExecStop=//root/ec2-user/bamboo-install/atlassian-bamboo-9.6.2/bin/stop-bamboo.sh stop sysd' \| sudo tee -a bamboo.service",  
"echo 'KillMode=control-group' \| sudo tee -a bamboo.service",  
"echo 'Environment=SYSTEMD_KILLMODE_WARNING=true' \| sudo tee -a bamboo.service",  
"echo 'SuccessExitStatus=143' \| sudo tee -a bamboo.service",  
"echo ' ' \| sudo tee -a bamboo.service",  
"echo '\[Install\]' \| sudo tee -a bamboo.service",  
"echo 'WantedBy=multi-user.target' \| sudo tee -a bamboo.service",  
"sudo mv bamboo.service /etc/systemd/system/",  
"sudo systemctl daemon-reload",  
"sudo start bamboo",  
Also may be related that when installing the agent software, the following error is displayed:  
null_resource.name (remote-exec): Installing file: /generic/bin/bamboo-agent.sh to: /root/bamboo-agent-home/bin/bamboo-agent.sh  
null_resource.name (remote-exec): Installing file: /root/bamboo-agent-home/conf/wrapper.conf  
null_resource.name (remote-exec): Installing file: /generic/lib/bamboo-agent-bootstrap-jar-with-dependencies.jar to: /root/bamboo-agent-home/lib/bamboo-agent-bootstrap.jar  
null_resource.name (remote-exec): Unzipping /classpath.zip to /root/bamboo-agent-home/classpath  
null_resource.name (remote-exec): Could not find source file /classpath.zip  
null_resource.name (remote-exec): Agent installed  
Any suggestions are appreciated. New to Linux and Bamboo.  
Thanks!


Answers:
author: Khushboo Gupta
body: Hello [@Mark C_ Duncan](/t5/user/viewprofilepage/user-id/5515518)

Welcome to Atlassian Community!

Based on your description, there are a couple of key issues that need to be addressed to get your Bamboo agent running as a service on AWS Linux 2 instance using Terraform with the `remote-exec` provisioner.

* Fixing the Systemd Service File and Start/Stop Commands: It looks like there's a typo in your `ExecStop` command (an extra slash at the beginning), and your `ExecStart` and `ExecStop` paths seem to be incorrect. You've mixed `/root/` with `ec2-user/` in the paths, which are typically home directories for different users on a Linux system. By default, `ec2-user` is the default user on AWS Linux instances, not `root`, so if you've installed Bamboo in the `ec2-user`'s home directory, ensure the paths are correct. Assuming Bamboo is installed in the `ec2-user` home directory, update the paths accordingly. It should look like below:
  * "echo 'ExecStart=/home/ec2-user/bamboo-install/atlassian-bamboo-9.6.2/bin/start-bamboo.sh start sysd' \| sudo tee -a /etc/systemd/system/bamboo.service"
  * "echo 'ExecStop=/home/ec2-user/bamboo-install/atlassian-bamboo-9.6.
* Additionally, the command to start the service should be **`sudo systemctl start bamboo`** , not `sudo start bamboo`. It should look like below:
  * "sudo systemctl enable bamboo",
  * "sudo systemctl start bamboo",

To resolve the "Could not find source file /classpath.zip" issue, you'll need to ensure that `classpath.zip` is indeed available and in the correct location expected by your installation script.

Hope it helps!

Regards,

Khushboo Gupta


Tags: start