No nohup logs on remote server
I'm trying to start a proccess on remote server with ssh.
I need to log stdout on target server (not the local one)
Here is the script:
sshpass -p mypwd ssh root@myserver.com nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &
Process starts fine, but logs are created on local server. Checked with
find . -name 'log.log'
I tried to wrap nohup command to double quotes
sshpass -p mypwd ssh root@myserver.com "nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &"
Process starts fine, but no logs are present on both servers.
How can I make nohup send stdout to log file on remote server?
bash ssh nohup
New contributor
add a comment |
I'm trying to start a proccess on remote server with ssh.
I need to log stdout on target server (not the local one)
Here is the script:
sshpass -p mypwd ssh root@myserver.com nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &
Process starts fine, but logs are created on local server. Checked with
find . -name 'log.log'
I tried to wrap nohup command to double quotes
sshpass -p mypwd ssh root@myserver.com "nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &"
Process starts fine, but no logs are present on both servers.
How can I make nohup send stdout to log file on remote server?
bash ssh nohup
New contributor
The last command should at least have createdlog.log
file on the server, or have failed if creating the file was impossible. Are you sure you know the directory where the command run? Did you look in the right directory? What if you redirected to a file with absolute path?
– Kamil Maciorowski
Jan 14 at 12:47
@Kamil Maciorowski, I've scanned entire server (from root) & checked manually the home folder and folder with jar. No file
– Ermintar
Jan 14 at 12:50
add a comment |
I'm trying to start a proccess on remote server with ssh.
I need to log stdout on target server (not the local one)
Here is the script:
sshpass -p mypwd ssh root@myserver.com nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &
Process starts fine, but logs are created on local server. Checked with
find . -name 'log.log'
I tried to wrap nohup command to double quotes
sshpass -p mypwd ssh root@myserver.com "nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &"
Process starts fine, but no logs are present on both servers.
How can I make nohup send stdout to log file on remote server?
bash ssh nohup
New contributor
I'm trying to start a proccess on remote server with ssh.
I need to log stdout on target server (not the local one)
Here is the script:
sshpass -p mypwd ssh root@myserver.com nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &
Process starts fine, but logs are created on local server. Checked with
find . -name 'log.log'
I tried to wrap nohup command to double quotes
sshpass -p mypwd ssh root@myserver.com "nohup java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 &"
Process starts fine, but no logs are present on both servers.
How can I make nohup send stdout to log file on remote server?
bash ssh nohup
bash ssh nohup
New contributor
New contributor
New contributor
asked Jan 14 at 12:32
ErmintarErmintar
1062
1062
New contributor
New contributor
The last command should at least have createdlog.log
file on the server, or have failed if creating the file was impossible. Are you sure you know the directory where the command run? Did you look in the right directory? What if you redirected to a file with absolute path?
– Kamil Maciorowski
Jan 14 at 12:47
@Kamil Maciorowski, I've scanned entire server (from root) & checked manually the home folder and folder with jar. No file
– Ermintar
Jan 14 at 12:50
add a comment |
The last command should at least have createdlog.log
file on the server, or have failed if creating the file was impossible. Are you sure you know the directory where the command run? Did you look in the right directory? What if you redirected to a file with absolute path?
– Kamil Maciorowski
Jan 14 at 12:47
@Kamil Maciorowski, I've scanned entire server (from root) & checked manually the home folder and folder with jar. No file
– Ermintar
Jan 14 at 12:50
The last command should at least have created
log.log
file on the server, or have failed if creating the file was impossible. Are you sure you know the directory where the command run? Did you look in the right directory? What if you redirected to a file with absolute path?– Kamil Maciorowski
Jan 14 at 12:47
The last command should at least have created
log.log
file on the server, or have failed if creating the file was impossible. Are you sure you know the directory where the command run? Did you look in the right directory? What if you redirected to a file with absolute path?– Kamil Maciorowski
Jan 14 at 12:47
@Kamil Maciorowski, I've scanned entire server (from root) & checked manually the home folder and folder with jar. No file
– Ermintar
Jan 14 at 12:50
@Kamil Maciorowski, I've scanned entire server (from root) & checked manually the home folder and folder with jar. No file
– Ermintar
Jan 14 at 12:50
add a comment |
1 Answer
1
active
oldest
votes
The point is that nohup must go before sshpass command to log all the output; every command with no nohup goes like this: nohup command
or nohup command > output.log 2>&1
New contributor
I tried to use nohup sshpass -p mypwd ssh root@myserver.com java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 & the result was the same.
– Ermintar
Jan 14 at 13:24
What worked for me: sshpass -p mypwd ssh root@myserver.com "java -jar /tmp/jenkins/myjar.jar > log.log &" I'm wondering why
– Ermintar
Jan 14 at 13:26
I should have worked to you; sometimes the redirection 2>&1 may cause interferences, if you type nohup shpass -p mypwd ssh root@myserver.com 'java -jar /tmp/jenkins/myjar.jar' > log.log it should redirect the output; the only point is that only the output would be redirected.
– Dasel
Jan 14 at 13:32
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
});
}
});
Ermintar is a new contributor. Be nice, and check out our Code of Conduct.
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%2f494403%2fno-nohup-logs-on-remote-server%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 point is that nohup must go before sshpass command to log all the output; every command with no nohup goes like this: nohup command
or nohup command > output.log 2>&1
New contributor
I tried to use nohup sshpass -p mypwd ssh root@myserver.com java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 & the result was the same.
– Ermintar
Jan 14 at 13:24
What worked for me: sshpass -p mypwd ssh root@myserver.com "java -jar /tmp/jenkins/myjar.jar > log.log &" I'm wondering why
– Ermintar
Jan 14 at 13:26
I should have worked to you; sometimes the redirection 2>&1 may cause interferences, if you type nohup shpass -p mypwd ssh root@myserver.com 'java -jar /tmp/jenkins/myjar.jar' > log.log it should redirect the output; the only point is that only the output would be redirected.
– Dasel
Jan 14 at 13:32
add a comment |
The point is that nohup must go before sshpass command to log all the output; every command with no nohup goes like this: nohup command
or nohup command > output.log 2>&1
New contributor
I tried to use nohup sshpass -p mypwd ssh root@myserver.com java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 & the result was the same.
– Ermintar
Jan 14 at 13:24
What worked for me: sshpass -p mypwd ssh root@myserver.com "java -jar /tmp/jenkins/myjar.jar > log.log &" I'm wondering why
– Ermintar
Jan 14 at 13:26
I should have worked to you; sometimes the redirection 2>&1 may cause interferences, if you type nohup shpass -p mypwd ssh root@myserver.com 'java -jar /tmp/jenkins/myjar.jar' > log.log it should redirect the output; the only point is that only the output would be redirected.
– Dasel
Jan 14 at 13:32
add a comment |
The point is that nohup must go before sshpass command to log all the output; every command with no nohup goes like this: nohup command
or nohup command > output.log 2>&1
New contributor
The point is that nohup must go before sshpass command to log all the output; every command with no nohup goes like this: nohup command
or nohup command > output.log 2>&1
New contributor
New contributor
answered Jan 14 at 12:36
DaselDasel
4497
4497
New contributor
New contributor
I tried to use nohup sshpass -p mypwd ssh root@myserver.com java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 & the result was the same.
– Ermintar
Jan 14 at 13:24
What worked for me: sshpass -p mypwd ssh root@myserver.com "java -jar /tmp/jenkins/myjar.jar > log.log &" I'm wondering why
– Ermintar
Jan 14 at 13:26
I should have worked to you; sometimes the redirection 2>&1 may cause interferences, if you type nohup shpass -p mypwd ssh root@myserver.com 'java -jar /tmp/jenkins/myjar.jar' > log.log it should redirect the output; the only point is that only the output would be redirected.
– Dasel
Jan 14 at 13:32
add a comment |
I tried to use nohup sshpass -p mypwd ssh root@myserver.com java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 & the result was the same.
– Ermintar
Jan 14 at 13:24
What worked for me: sshpass -p mypwd ssh root@myserver.com "java -jar /tmp/jenkins/myjar.jar > log.log &" I'm wondering why
– Ermintar
Jan 14 at 13:26
I should have worked to you; sometimes the redirection 2>&1 may cause interferences, if you type nohup shpass -p mypwd ssh root@myserver.com 'java -jar /tmp/jenkins/myjar.jar' > log.log it should redirect the output; the only point is that only the output would be redirected.
– Dasel
Jan 14 at 13:32
I tried to use nohup sshpass -p mypwd ssh root@myserver.com java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 & the result was the same.
– Ermintar
Jan 14 at 13:24
I tried to use nohup sshpass -p mypwd ssh root@myserver.com java -jar /tmp/jenkins/myjar.jar > log.log 2>&1 & the result was the same.
– Ermintar
Jan 14 at 13:24
What worked for me: sshpass -p mypwd ssh root@myserver.com "java -jar /tmp/jenkins/myjar.jar > log.log &" I'm wondering why
– Ermintar
Jan 14 at 13:26
What worked for me: sshpass -p mypwd ssh root@myserver.com "java -jar /tmp/jenkins/myjar.jar > log.log &" I'm wondering why
– Ermintar
Jan 14 at 13:26
I should have worked to you; sometimes the redirection 2>&1 may cause interferences, if you type nohup shpass -p mypwd ssh root@myserver.com 'java -jar /tmp/jenkins/myjar.jar' > log.log it should redirect the output; the only point is that only the output would be redirected.
– Dasel
Jan 14 at 13:32
I should have worked to you; sometimes the redirection 2>&1 may cause interferences, if you type nohup shpass -p mypwd ssh root@myserver.com 'java -jar /tmp/jenkins/myjar.jar' > log.log it should redirect the output; the only point is that only the output would be redirected.
– Dasel
Jan 14 at 13:32
add a comment |
Ermintar is a new contributor. Be nice, and check out our Code of Conduct.
Ermintar is a new contributor. Be nice, and check out our Code of Conduct.
Ermintar is a new contributor. Be nice, and check out our Code of Conduct.
Ermintar is a new contributor. Be nice, and check out our Code of Conduct.
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%2f494403%2fno-nohup-logs-on-remote-server%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
The last command should at least have created
log.log
file on the server, or have failed if creating the file was impossible. Are you sure you know the directory where the command run? Did you look in the right directory? What if you redirected to a file with absolute path?– Kamil Maciorowski
Jan 14 at 12:47
@Kamil Maciorowski, I've scanned entire server (from root) & checked manually the home folder and folder with jar. No file
– Ermintar
Jan 14 at 12:50