tput: No value for $TERM and no -T specified error logged by CRON process
Something in the script is calling the tput
binary. tput
attempts to inspect the $TERM
variable to determine the current terminal so it can produce the correct control sequences. There isn't a terminal when cron is running so you get that error from tput
.
You can either manually assign a TERM
value to the cron job (likely dumb
or something similar to that) or (and this is likely the better solution) you can find out what is calling tput
and remove that call.
tput: No value for $TERM and no -T specified when command run over ssh
Option One: Making ssh
provide a TTY
Pass -tt
to ssh to force it to provide a TTY, and pass TERM
through explicitly if you don't trust ssh to be configured to do so implicitly:
#!/bin/bash
# ^^^^- the below printf usage is not available in baseline POSIX sh
printf -v term_q '%q' "$TERM"
ssh -t root@"$node_name" "TERM=$term_q bash -s" < ./script.sh
Of course, this only makes sense if your ssh
is run from a terminal. If it's run from a cron job, then you need something different.
Option Two: Making Do Without One
The operation you're running is one that only makes sense in the context of a terminal. With no terminal, there doesn't exist a terminal width for tput
to look up; and with no terminal type set via the TERM
environment variable, there's no control sequence available for it to use.
Consider setting a default for noninteractive use:
# if we have no TERM, and no preexisting COLUMNS, set our own
[[ $TERM || $COLUMNS ]] || COLUMNS=80
...or writing your code to handle the case itself:
# skip this command altogether if we have no TERM or COLUMNS
[[ $TERM || $COLUMNS ]] && printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
(Note that assigning to COLUMNS
is not particularly well-defined behavior; some shells may not allow it; they're well within the POSIX specification to do so, as the shell and system utilities are allowed to make their own use of all-caps variable names; only lower-case names are guaranteed safe for other applications to use).
How can I intercept errors from gzip so cron doesn't see them?
I've not tested it, but something like:
$gunzip_result=system("gunzip $gzfile 2>/dev/null");
Quicker syntax for Jenkins identical parallel stages
Please see below code which will create and run the stage on multiple agents:
// Define your agents
def agents = ['agent-1','agent-2','agent-3']
def createStage(label) {
return {
stage("Runs on ${label}") {
node(label) {
// build steps that should happen on all nodes go here
echo "Running on ${label}"
sh 'do task number 468'
}
}
}
}
def parallelStagesMap = agents.collectEntries {
["${it}" : createStage(it)]
}
pipeline {
agent none
stages {
stage('parallel stage') {
steps {
script {
parallel parallelStagesMap
}
}
}
}
}
More information is available at : Jenkins examples
Related Topics
Cannot Install Extensions in Visual Studio Code
How to Launch Multiple Xterm Windows and Run a Command on Each, Leaving Each Window Open Afterward
"Tput: No Value for $Term and No -T Specified " Error Logged by Cron Process
What Makes the Gcc Std::List Sort Implementation So Fast
Writing a Bash For-Loop with a Variable Top-End
System D-Bus Does Not Allow Punching Out Ownership with Conf Files
How to Tie a Network Connection to a Pid Without Using Lsof or Netstat
How to Print Message to Stderr in Go
Linker Cannot Find Symbols, But Libraries Are Read and Symbols Exist
Running Scheme from the Command Line
How to Interpret Segment Register Accesses on X86-64
Shell Script Printing Contents of Variable Containing Output of a Command Removes Newline Characters
How to Make Ffmpeg Write Its Output to a Named Pipe
Linux, Print All Lines in a File, Not Starting With
How to Use .Notparallel in Makefile Only on Specific Targets