You are not logged in.
Is there any way that if I log in with a username, it automatically attached to an existing Screen session, or if there isn't any, creates one?
Last edited by Lenry (2012-05-10 17:02:02)
Offline
I use this in my .profile (you can adapt for screen):
elif [[ $(tty) = /dev/tty2 ]]; then
tmux -f $HOME/.tmux/conf new -s secured
fiJust add an additional test to check if you already have a session running...
Offline
I use this in my .profile (you can adapt for screen):
elif [[ $(tty) = /dev/tty2 ]]; then tmux -f $HOME/.tmux/conf new -s secured fiJust add an additional test to check if you already have a session running...
Ummm. I know it's a shame, but I don't have the slightest idea how to do that...
Offline
*confused*
Which part do you not know how to do? The screen attachment? That's pretty clear in `man screen`, there is not even a need for an additional test.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
*confused*
Which part do you not know how to do? The screen attachment? That's pretty clear in `man screen`, there is not even a need for an additional test.
the part where I adapt it for screen. Unfortunately I'm not familiar with shell scripting and stuff.
Offline
Well I'm not sure what you're going to do in a screen session if you don't know any shell commands.
Replace the tmux line with your screen command. In fact, if you want screen to start whenever you log in to any shell (tty and term emulator) then you can ditch the conditionals and just put a very vanilla screen command in your ~/.bashrc.
EDIT: as tone is lost online, I wanted to clarify that I didn't mean this in any judgmental or mean way at all. I was just genuinely confused. Many people would not know anything about shell commands ... they just wouldn't be looking for a way to run a screen sesssion.
Last edited by Trilby (2012-05-10 12:48:43)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Well I'm not sure what you're going to do in a screen session if you don't know any shell commands.
Replace the tmux line with your screen command. In fact, if you want screen to start whenever you log in to any shell (tty and term emulator) then you can ditch the conditionals and just put a very vanilla screen command in your ~/.bashrc.
EDIT: as tone is lost online, I wanted to clarify that I didn't mean this in any judgmental or mean way at all. I was just genuinely confused. Many people would not know anything about shell commands ... they just wouldn't be looking for a way to run a screen sesssion.
I know, I sounded / looked stupid, sorry for the lame questions
Of course I know shell commands, I just don't use these ~/.anythingrc files, as I really rarely need them, and don't know how to use them, what are they syntaxes, etc.
I have a small linux based fileserver, with remote access and I would like to use screen, for seeing the same stuff, the same processes and running programs from anywhere. It works really good if I start it manually (screen first and screen -x from my other devices), but I wanted to start screen automatically, as I sometimes forget it, and you can be sure that I'd need it then...
Last edited by Lenry (2012-05-10 13:12:54)
Offline
Each user has a .bashrc file in their ~ directory. These files don't have any special syntax: they're just a series of commands that could be given a the command prompt.
You can put your screen -R command right in your .bashrc and it will start whenever you login to a (bash) shell.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Each user has a .bashrc file in their ~ directory. These files don't have any special syntax: they're just a series of commands that could be given a the command prompt.
You can put your screen -R command right in your .bashrc and it will start whenever you login to a (bash) shell.
screen -R always started a new screen session on every login, but screen -xR does the trick. thank you for your help
Offline