Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

513
Visualizações
screen Cannot open your terminal '/dev/pts/0' - please check

I want to start a program in a screen as the user "XYZ" with a script. This is my script in short form:

# replace <newuser> with the user you wish to run teamspeak 3 with.
USER="teamspeak"
# Do not change this path
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# The path to the teamspeak 3 server/scripts . example = /home/teamspeak3/teamspeak3-server
DIR=/home/teamspeak/voiceserver/teamspeak3
DAEMON=$DIR/ts3server_startscript.sh
# Change all PARAMS to your needs. I required the ini so teamspeak used MySQL
PARAMS="inifile=ts3server.ini"
#Name = The screen will be named from this.
NAME=teamspeak3
DESC="Teamspeak Server 3"


case "$1" in
start)
echo "Starting $DESC"
script -q -c "su $USER -l -c \"screen -m -d -S $NAME $DAEMON start\"" /dev/null
;;
stop)
su $USER -l -c "screen -S $NAME  -X quit "
    echo " ... done. $DESC Stopped."
;;
restart)
su $USER -l -c "screen -S $NAME  -X quit "
    echo " Closed Process, Restarting"
script -q -c "su $USER -l -c \"screen -m -d -S $NAME $DAEMON start\"" /dev/null
echo " ... done. $DESC Restarted"
;;
status)
# Check whether there's a "Team Speak 3" process
ps aux | grep -v grep | grep ts3server_ > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "$DESC is UP" || echo "$DESC is DOWN"
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0

I want connect in the screen, but I got this.

Cannot open your terminal '/dev/pts/0' - please check.

Did I do something wrong?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

This happens because you may have done a sudo su user_name and then fired the screen command.

There are 2 ways to fix this.

  1. Login directly to "user_name" via ssh.
  2. Take ownership of the shell by typing script /dev/null as the user user_name and then type screen
over 4 years ago · Santiago Trujillo Relatório

0

To solve the problem try running script /dev/null as the user you su to before launching screen.

script -q -c "su $USER -l -c \"screen -m -d -S $NAME $DAEMON start\"" /dev/null

More on it:

  • https://serverfault.com/questions/116775/sudo-as-different-user-and-running-screen/116830
over 4 years ago · Santiago Trujillo Relatório

0

Inspired by both endorsed answers here I added the following function to my .bashrc:

sscreen(){
    script -q -c "screen $*" /dev/null;
}

Now I just use sscreen instead of screen and never have to think about the issue again.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda