Home > Net >  linux terminal freezes script output when it is run as systemd script after some time
linux terminal freezes script output when it is run as systemd script after some time

Time:07-09

I'm just writing a program which should run on linux main terminal TTY1 as a "more interactive" replacement for plymouth.

Everthing is ok. After one hour or two, the display freezed until any keystroke is pressed, lets for example assume that I run a bash loop which is displaying time, its gone after some time and only displays last iteration when some timeout occured.

My service:

[Unit]
Description=Script starter
After=getty.target
[email protected]

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/screen.sh
StandardInput=tty-force

[Install]
WantedBy=multi-user.target

and script:

#!/bin/bash

while true
do
    sleep 1
    clear
    date
done

the same issue is when I run program I wroted in c/ncurses

CodePudding user response:

With your information so far, it is hard so say why there is a freeze. Maybe you switch tty and there isn't enough RAM after "one or two hours". Maybe you have a defect hardware (graphic card, cpu, ram). Maybe, maybe...

Try to write your sdtout in a file and read it with tail.

#!/bin/bash
clear
while true
do
    sleep 1
    date >> logFile
done

And in another console try this:

tail -f --retry logfile

-f stands for follow

--retry if the file is not available, it will retry to read it.

CodePudding user response:

I was looking whole day, what causes that console screen freezes displaying dead timer and I found cause.

the kernel parameter consoleblank, I set to 0 and reinstall grub, after that its working

Idk, how its behaves on normal pc, I was using virtual console offered by vsphere

so yest consoleblank=0 grub reinstall

  • Related