Hello All!
I am attempting to run a process written in Cobol using the Gnu Cobol compiler and keep getting the follow when trying to run it:
Error opening terminal: unknown.
On Thu, 26 Mar 2020 14:05:12 +0000, Vincent Coen wrote:
Hello All!
I am attempting to run a process written in Cobol using the Gnu
Cobol compiler and keep getting the follow when trying to run it:
Error opening terminal: unknown.
It might have helped to show how you are getting cron to run whatever
you are doing.
I have seen some of my scripts complain about terminal things.
Since I want my scripts to run in cron or interactively, I test that
if running in cron, go ahead and set some terminal values.
all my scripts include a function/file to set desired default
variables.
So here is a snippet from that include file:
tty --silent
export _cron_flg=$? # $?=0 interactive $?=1 cron
if [ $_cron_flg -eq 1 ] ; then
export COLUMNS=80
export LINES=24
export TERM=vt420
fi
Thursday March 26 2020 14:41, Bit Twister wrote to All:
So here is a snippet from that include file:
tty --silent
export _cron_flg=$? # $?=0 interactive $?=1 cron
if [ $_cron_flg -eq 1 ] ; then
export COLUMNS=80
export LINES=24
export TERM=vt420
fi
Do not fully understand the above but the program uses ncurses so runs in a terminal and I use qterminal as that is one of the few available in the repos.
Do not fully understand the above but the program uses ncurses so
runs in a terminal and I use qterminal as that is one of the few
available in the repos.
The script is simply setting variables some programs expect, if it's
running in interactive mode.
As cron jobs must be able to run without a tty (i.e. terminal), that
script will not help with running a program that accesses a tty.
The cron job may work with redirection ...
somecommand > /somefile.txt 2>&1 0</dev/null
but if the program uses direct i/o for the terminal, that will also
fail, in which case the answer is that the program simply can not be
run as a cron job.
Another option might be to always leave a user logged in, and run the
job using a script in an open terminal, such as konsole that runs the program every hour.
Regards, Dave Hodgins
Hello Bit!
Thursday March 26 2020 14:41, Bit Twister wrote to All:
On Thu, 26 Mar 2020 14:05:12 +0000, Vincent Coen wrote:
Hello All!
I am attempting to run a process written in Cobol using the Gnu
Cobol compiler and keep getting the follow when trying to run it:
Error opening terminal: unknown.
It might have helped to show how you are getting cron to run whatever
you are doing.
I have seen some of my scripts complain about terminal things.
Since I want my scripts to run in cron or interactively, I test that
if running in cron, go ahead and set some terminal values.
all my scripts include a function/file to set desired default
variables.
So here is a snippet from that include file:
tty --silent
export _cron_flg=$? # $?=0 interactive $?=1 cron
if [ $_cron_flg -eq 1 ] ; then
export COLUMNS=80
export LINES=24
export TERM=vt420
fi
Do not fully understand the above but the program uses ncurses so runs in a terminal and I use qterminal as that is one of the few available in the repos.
Checking it in via control center, software says :
QT-based multitab terminal emulator. Based on QTermWidget
Executing program uses 80 x 24 lines but does not need any response from a user as it takes input from files only.
The crontab shows :
#Hourly
00 0-23 * * * $HOME/etc/hourly
10 0-23 * * * $HOME/bin/run-elist.sh UPDATE ALL SKIP-PASSWORD
It is the last line as the one before does the same error and I am trying
to find a fix ?
The content of the file run-elist.sh is :
#!/bin/bash
# 24/02/2020 vbc - v1.00 created
# 23/03/2020 vbc - v1.01 removed the exit RT so it get to top level for testing
# when I get around to it.
#
cd /home/mbse/elist
if [ ! -d backups ]; then
mkdir backups
fi
if [ ! -d rules ]; then
mkdir rules
fi
if [ ! -d originals ]; then
mkdir originals
fi
#
#if [ $1 == ""]; then
# echo "No paramter given - Aborting"
#fi
#export COB_TRACE_FILE=/home/mbse/trace.log
#export COB_SET_TRACE=TRUE
# NEXT ONE for building or running Regression tests in REPORT
#export COB_CURRENT_DATE="2020/02/29 23:45:00"
#export LC_TIME=en_GB
#
/home/mbse/bin/elist $1 $2 $3 $4
exit
The first two export lines are some times set if I am debugging the program elist.
As you can see there are 3 params passed to elist UPDATE ALL SKIP-PASSWORD
If I run it manually from the kde screen I load qterminal which is preset
to use 80 wide by 40+ lines long then run the same script ( run-elist.sh ).
Comes to EOJ as expected, it is just trying to run it automatically every hour this error comes up so I am assuming crontab find out it needs a terminal to run in but has 'terminal' preset as the tool to use and in may case instead of 'qterminal'.
So the issue seems to be possibly fixed if I can tell cron to run the right terminal program that in turns runs elist via script run-elist.sh.
Have I explained it better now ?
Vincent
That may well be the way I have to do it but then have to find a way of
doing just that - running the script once per hour.
Will be a pity if I have to have a user account open as it could be a bit
of a security hole.
On Thu, 26 Mar 2020 19:43:44 -0400, Vincent Coen <VBCoen@gmail.com> wrote:autostart
That may well be the way I have to do it but then have to find a way of
doing just that - running the script once per hour.
Will be a pity if I have to have a user account open as it could be a bit
of a security hole.
Running it once per hour is easy. Have whatever desktop environment's
run the script at login, in a terminal. Have the first executable line ofthe
script be ...
echo "$0" | at now + 1 hour 2> /dev/null
Hello David!
Thursday March 26 2020 19:26, David W. Hodgins wrote to All:
Do not fully understand the above but the program uses ncurses so
runs in a terminal and I use qterminal as that is one of the few
available in the repos.
The script is simply setting variables some programs expect, if it's running in interactive mode.
As cron jobs must be able to run without a tty (i.e. terminal), that
script will not help with running a program that accesses a tty.
Nope, the program runs totally stand alone once per hour.
It looks for two file extensions of .ECO and .RUL
It does a ls *.ECO *.eco *.rul *.RUL > fred
It them process fred and for each file present processes it updating a database and may be produces report files.
That is it. For now I am trying an experiement having done a
ln -sf /usr/bin/qterminal /usr/bin/terminal
I will see in 15 minutes if it works but as it was possibly an easy fix I
am not holding my breath.
The cron job may work with redirection ...
somecommand > /somefile.txt 2>&1 0</dev/null
but if the program uses direct i/o for the terminal, that will also
fail, in which case the answer is that the program simply can not be
run as a cron job.
Another option might be to always leave a user logged in, and run the
job using a script in an open terminal, such as konsole that runs the program every hour.
That may well be the way I have to do it but then have to find a way of
doing just that - running the script once per hour.
Will be a pity if I have to have a user account open as it could be a bit
of a security hole.
Regards, Dave Hodgins
Thanks for the suggestion.
Vincent
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 368 |
Nodes: | 16 (2 / 14) |
Uptime: | 84:05:06 |
Calls: | 7,895 |
Calls today: | 1 |
Files: | 12,968 |
Messages: | 5,791,775 |