Pipe nohup output to logger w/ different priorities
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.
Running a simple command w/o nohup seems to work:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)
Running this /w nohup however yields unexpected results
nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &
The log will contain "nohup: ignoring input" and sometimes even empty entries.
Can somebody help me to write this command properly ?
nohup logger
add a comment |Â
up vote
2
down vote
favorite
I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.
Running a simple command w/o nohup seems to work:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)
Running this /w nohup however yields unexpected results
nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &
The log will contain "nohup: ignoring input" and sometimes even empty entries.
Can somebody help me to write this command properly ?
nohup logger
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.
Running a simple command w/o nohup seems to work:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)
Running this /w nohup however yields unexpected results
nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &
The log will contain "nohup: ignoring input" and sometimes even empty entries.
Can somebody help me to write this command properly ?
nohup logger
I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.
Running a simple command w/o nohup seems to work:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)
Running this /w nohup however yields unexpected results
nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &
The log will contain "nohup: ignoring input" and sometimes even empty entries.
Can somebody help me to write this command properly ?
nohup logger
asked Nov 10 '17 at 14:00
Jan Goyvaerts
1111
1111
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
You're redirecting the output of nohup
to logger. To redirect the output of ls
(or your python script), you can use command substitution:
nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &
Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token>' -sh: command substitution: line 80:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
â Jan Goyvaerts
Nov 13 '17 at 13:05
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You're redirecting the output of nohup
to logger. To redirect the output of ls
(or your python script), you can use command substitution:
nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &
Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token>' -sh: command substitution: line 80:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
â Jan Goyvaerts
Nov 13 '17 at 13:05
add a comment |Â
up vote
0
down vote
You're redirecting the output of nohup
to logger. To redirect the output of ls
(or your python script), you can use command substitution:
nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &
Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token>' -sh: command substitution: line 80:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
â Jan Goyvaerts
Nov 13 '17 at 13:05
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You're redirecting the output of nohup
to logger. To redirect the output of ls
(or your python script), you can use command substitution:
nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &
You're redirecting the output of nohup
to logger. To redirect the output of ls
(or your python script), you can use command substitution:
nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &
answered Nov 11 '17 at 17:24
cherdt
6361415
6361415
Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token>' -sh: command substitution: line 80:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
â Jan Goyvaerts
Nov 13 '17 at 13:05
add a comment |Â
Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token>' -sh: command substitution: line 80:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
â Jan Goyvaerts
Nov 13 '17 at 13:05
Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token
>' -sh: command substitution: line 80:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?â Jan Goyvaerts
Nov 13 '17 at 13:05
Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token
>' -sh: command substitution: line 80:
ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?â Jan Goyvaerts
Nov 13 '17 at 13:05
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403758%2fpipe-nohup-output-to-logger-w-different-priorities%23new-answer', 'question_page');
);
Post as a guest
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
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
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