How to start the upstart process for golang application?
Clash Royale CLAN TAG#URR8PPP
I am using upstart to start my golang application. I have my application folder structure like this,
Web-app/
/app
main.go
I built the application
$cd /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app/
$go build ./...
It generated app [executable file] under app folder as app.
And placed the web-app.conf
in /etc/init/
folder. Here is the web-app.conf content,
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
script
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
end script
When I tried sudo initctl list, it lists the process as stop/waiting. And I tried to start the process
$sudo initctl start web-app
It shows the process as start/running. But it is not started.
I checked the /var/log/messages
logs. It shows,
init: web-app main process (18740) terminated with status 127
I couldn't start the process. I think there is some issue with the chdir. I tried different options for past two days but no luck. And I am fairly new to upstart. Could someone help me with this?
linux amazon-ec2 upstart
add a comment |
I am using upstart to start my golang application. I have my application folder structure like this,
Web-app/
/app
main.go
I built the application
$cd /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app/
$go build ./...
It generated app [executable file] under app folder as app.
And placed the web-app.conf
in /etc/init/
folder. Here is the web-app.conf content,
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
script
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
end script
When I tried sudo initctl list, it lists the process as stop/waiting. And I tried to start the process
$sudo initctl start web-app
It shows the process as start/running. But it is not started.
I checked the /var/log/messages
logs. It shows,
init: web-app main process (18740) terminated with status 127
I couldn't start the process. I think there is some issue with the chdir. I tried different options for past two days but no luck. And I am fairly new to upstart. Could someone help me with this?
linux amazon-ec2 upstart
add a comment |
I am using upstart to start my golang application. I have my application folder structure like this,
Web-app/
/app
main.go
I built the application
$cd /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app/
$go build ./...
It generated app [executable file] under app folder as app.
And placed the web-app.conf
in /etc/init/
folder. Here is the web-app.conf content,
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
script
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
end script
When I tried sudo initctl list, it lists the process as stop/waiting. And I tried to start the process
$sudo initctl start web-app
It shows the process as start/running. But it is not started.
I checked the /var/log/messages
logs. It shows,
init: web-app main process (18740) terminated with status 127
I couldn't start the process. I think there is some issue with the chdir. I tried different options for past two days but no luck. And I am fairly new to upstart. Could someone help me with this?
linux amazon-ec2 upstart
I am using upstart to start my golang application. I have my application folder structure like this,
Web-app/
/app
main.go
I built the application
$cd /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app/
$go build ./...
It generated app [executable file] under app folder as app.
And placed the web-app.conf
in /etc/init/
folder. Here is the web-app.conf content,
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
script
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
end script
When I tried sudo initctl list, it lists the process as stop/waiting. And I tried to start the process
$sudo initctl start web-app
It shows the process as start/running. But it is not started.
I checked the /var/log/messages
logs. It shows,
init: web-app main process (18740) terminated with status 127
I couldn't start the process. I think there is some issue with the chdir. I tried different options for past two days but no luck. And I am fairly new to upstart. Could someone help me with this?
linux amazon-ec2 upstart
linux amazon-ec2 upstart
asked Jul 4 '16 at 5:50
DanyDany
1447
1447
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The exit status 127 means the command could not be found. Your problem is you are trying to use an upstart stanzas inside the script block so upstart is trying to execute it as a command, which does not exist. You should move it above the script block instead.
Also since you are only using exec in the script block you can remove it and just use exec
.
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f293692%2fhow-to-start-the-upstart-process-for-golang-application%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The exit status 127 means the command could not be found. Your problem is you are trying to use an upstart stanzas inside the script block so upstart is trying to execute it as a command, which does not exist. You should move it above the script block instead.
Also since you are only using exec in the script block you can remove it and just use exec
.
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
add a comment |
The exit status 127 means the command could not be found. Your problem is you are trying to use an upstart stanzas inside the script block so upstart is trying to execute it as a command, which does not exist. You should move it above the script block instead.
Also since you are only using exec in the script block you can remove it and just use exec
.
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
add a comment |
The exit status 127 means the command could not be found. Your problem is you are trying to use an upstart stanzas inside the script block so upstart is trying to execute it as a command, which does not exist. You should move it above the script block instead.
Also since you are only using exec in the script block you can remove it and just use exec
.
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
The exit status 127 means the command could not be found. Your problem is you are trying to use an upstart stanzas inside the script block so upstart is trying to execute it as a command, which does not exist. You should move it above the script block instead.
Also since you are only using exec in the script block you can remove it and just use exec
.
#Web app upstart script
description "start and stop web app"
start on (net-device-up
and local-filesystems
and rullevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
chdir /home/ec2-user/go/src/github.com/dineshappavoo/web-app/app
exec ./app
answered Jul 4 '16 at 15:22
Michael DaffinMichael Daffin
2,7951619
2,7951619
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f293692%2fhow-to-start-the-upstart-process-for-golang-application%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown