Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
i have started using the "screen" utility to launch processes that i need to dis- and re-connect to.
but i also need to stop and start these screen sessions with crontab (i.e. on a schedule)
this is the command i use to start a rtorrent screen session:
screen -d -m rtorrent
currently, i then use this to end it:
screen -r -X quit
however, the proper way to exit rtorrent is by pressing Control-A (key combo) and then the "q" key.
HOW CAN I SCRIPT THIS??!??!?? i am going insane!
so far, i know i need to use the "-X stuff ...." option, but i do not know how to pass in a control key combo sequence!
i have tried this, unsuccessfully:
screen -r -X stuff ^aq
this is within a bash shell session, so alternatively, if anyone can tell me how to script sending a control key combo, this may help...
please, anyone that can help me... you're my only hope!
You can assign the value of ctrl-A in its octal representation to a shell variable, by means of the echo command and then use it in the command line. From man page of echo:
Quote:
If -e is in effect, the following sequences are recognized:
\0NNN the character whose ASCII code is NNN (octal)
so the command substitution
Code:
$(echo -e '\0001')
where 001 is the octal code for Ctrl-A should give the desired value inside scripts or crontab entries.
Hey, I've been trying to do this also. Actually I'm just trying to use aliases to do some quick gameserver startup/exiting. I've got remote access to my dedicated server that is running CentOS, and I connect to it from my Windows client using PuTTY.
Currently I have these aliases:
alias bf2s='screen -S bf2screen;'
alias bf2run='cd /home/bf2user/gamecreate/bf2/; /bin/bash ./start.sh +dedicated +lowPriority'
alias bf2show='screen -r bf2screen'
And what I do to start up the server is:
- I type bf2s, which opens the blank screen.
- Inside the screen I type bf2run, which starts the gameserver inside the screen session.
- Then I do a Ctrl-A, Ctrl-D to leave the screen.
- If I ever want to view the status I type bf2show, and do another Ctrl-A, Ctrl-D to leave the screen again.
- To shutdown this gameserver I either have to kill the screen and server processes manually by their PID, or I have to type bf2show, and then type exit, to close the screen session containing the game server.
What I'd like to do is:
- Have an alias (or a script that could be called by an alias) that would start up the server inside a screen using only one command.
- Have an alias (or a script that could be called by an alias) that would shutdown the server and the screen using only one command.
I've tried a number of things including piping and using < and > to send commands to the screen from a single prompt with no luck.
Can anyone give me a clue here? I've taken a basic linux class and am taking an Admin and Install linux class this coming semester, but this is beyond my knowledge.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.