nohup sh -c "echo `date` >>logfile.txt && ls -l >>logfile.txt && echo `date` >>logfile.txt" &
or - alternatively - without the trainling "&":
nohup sh -c "echo `date` >>logfile.txt && ls -l >>logfile.txt && echo `date` >>logfile.txt" &
I always got a response:
nohup: appending output to `nohup.out'
file nohup.out is created but always empty. logfile.txt is filled as intended.
How can I suppress the nohup.out message and the nohup.out file creation?
Wolfgang
> When I perform the following command:
> nohup sh -c "echo `date` >>logfile.txt && ls -l >>logfile.txt && echo `date` >>logfile.txt" &
> or - alternatively - without the trainling "&":
> nohup sh -c "echo `date` >>logfile.txt && ls -l >>logfile.txt && echo `date` >>logfile.txt" &
Those commands are exactly the same. Did you intend them to be different?
> How can I suppress the nohup.out message and the nohup.out file creation?
Redirect the output to a file instead of letting it display on the terminal.
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
The nohup command sees the arguments 'sh' '-c' and a long quoted string.
To suppress nohup.out, you need to redirect nohup's output.
> nohup sh -c "echo `date` >>logfile.txt && ls -l \
> >>logfile.txt && echo `date` >>logfile.txt" &
Redirect std{in,out,err} of nohup:
$ nohup sh -c 'date; ls -l; date' </dev/null >>logfile.txt 2>&1 &
> How can I suppress the nohup.out message and the nohup.out file creation?
2>/dev/null will suppress the message, but you can't prevent hohup.out ...
just ignore it.
>
> Wolfgang
Bye, Jojo
nohup sh -c 'date;ls-l;date' >> logfile.txt &
Dan Mercer
Hi,
i think that you cannot suppress nohup.out file creation.
From the man page:
FILES
nohup.out The output file of the nohup execu-
tion if standard output is a termi-
nal and if the current directory is
writable.
$HOME/nohup.out The output file of the nohup execu-
tion if standard output is a termi-
nal and if the current directory is
writable
It indicates that every time nohup is called from terminal, it creates
the nohup.out file.
Regards
[snip]
> i think that you cannot suppress nohup.out file creation. From the man
> page:
> FILES
> nohup.out The output file of the nohup execu-
> tion if standard output is a termi-
> nal and if the current directory is
> writable.
"if standard output is a terminal".
So make it not a terminal. Redirect the output.
[snip]
--
| Darren Salt | linux or ds at | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| + RIPA NOTICE: NO CONSENT GIVEN FOR INTERCEPTION OF MESSAGE TRANSMISSION
How much for the rocket launcher? ...does this include ammo?