How to make an autostart script with screen sesion
Hi all,
Here is my question: I would like to autostart script with screen session. Here it is manual solution: Code:
cd /opt/directory Code:
screen -S 0 Code:
./run.sh I would like to place it to /etc/rc.d/rc.local (this is Linux Centos), and start it while the whole box has started. I tried something like: Code:
cd /opt/directory && screen -p 0 -X stuff './run.sh^M' What I am doing wrong? How to make it work as design? |
I'd recommend using absolute paths for all those cmds and lose the '^M', that's an MSWin line ending.
|
Thanks, but it does not seems to work....
My main concern is that this script print lots of messages on the monitor - and when I do something like 'screen -x' I cannot see those messages. Is this correct, or not correct? |
Hi all,
I manage to run it: Place it in a file - /etc/rc.local – using vi editor, at the end of the file – and you are good to go. Code:
cd /opt/directory && /usr/bin/screen -s /bin/bash -dmS XHSS ./run.sh -s /bin/bash - is the name of the SHELL to run it. XHSS - name of the screen session ./run.sh - name of the script to run when The main problem was with my settings of .screenrc file which keeps setting for screen session. Basically saying - I played to much with it, hence the issue. Hope that helps. Marking as solved. |
All times are GMT -5. The time now is 07:44 PM. |