Score:-1

crontab relative log path output not generated

cc flag

10 5 * * * rm ./rehldslog && cd ./code/rehlds && rm -rf ./build && ./build.sh --compiler=gcc --jobs=4 > ~/rehldslog 2>&1

in the logs i can see (CRON) info (No MTA installed, discarding output) and the command did not run as there is no build directory

what is wrong with that output syntax?

hr flag
Not sure if it's significant here, but you're only redirecting the output/error streams of the last command in your chain
eetzt avatar
cc flag
yes the build.sh output is what i want. but this MTA msg indicates that it wanted to email my output. i read i must use `&>` to get any output?
hr flag
Wrap the whole command chain in a subshell `( ... ) > ~/rehldslog 2>&1` or command group `{ ... ; } > ~/rehldslog 2>&1`
eetzt avatar
cc flag
ok now i run that command and came `rm: cannot remove './rehldslog': No such file or directory`. does that mean that my command chain totally failed with this error? so `rm -f rehldslog` will fix that
Martin Thornton avatar
cn flag
Crontabs use `sh` not `bash` as you've tagged. So don't break things with the `&>` you just read about. The `2>&1` already solved that problem anyway.
eetzt avatar
cc flag
nothing is solved, there is no output logged into rehldslog until now
Score:0
cc flag

my rm syntax was missing -f

correct:

10 5 * * * (rm -f ./rehldslog && cd ./code/rehlds && rm -rf ./build && ./build.sh --compiler=gcc --jobs=4) &> ~/rehldslog 2>&1

eetzt avatar
cc flag
ok `&> ~/rehldslog` did not collect the output. whats wrong. the commands all ran
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.