LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Launch a text program inside a konsole at startup (https://www.linuxquestions.org/questions/programming-9/launch-a-text-program-inside-a-konsole-at-startup-4175458929/)

PierreB. 04-20-2013 04:14 PM

Launch a text program inside a konsole at startup
 
Hi LQ'ers,

I am trying to setup a (very) simple startup script on a centos 6.4 computer and it kind of failed.... Here are the details :

As said just above the computer setup is running a CentOS 6.4 x64, on this computer a vncserver is automatically started (by a chkconfig vncserver on), i use this vncserver to remotely access the computer and to run ktorrent too.
This setup worked very well for the last 3 years (upon different Fedora based distros).

I have to use rtorrent for some private tracker, i then would like to make it (rtorrent) startup automaticallyjust like ktorrent.

I wrote a little piece of script to achieve what i thought to be a simple and quick task, BUT, it doesn't work.

I created a new user (called rtorrent_user) to run rtorrent app, i also setup a sudo to allow the vncserver user to run rtorrent app as rtorrent_user.

When i launch the script from a konsole everything works, but when i setup the script for an automatic startup (symlinking manually or using the CentOS GUI) the script ran but no konsole+rtorrent appears...

If you have an idea ???


Here is the script :
Code:

#!/bin/bash

# Start rtorrent automatically when vncserver start for user "pier"
# add rtorrent to the X server "access control list" :
wall "launched"
xhost + SI:localuser:rtorrent
# Now start rtorrent from inside a "konsole" (the following requires a correct sudoers file) :
konsole -e sudo -u rtorrent konsole -e rtorrent

The wall command allow me to ensure the script was really launched at startp, and it did but nothing happened after....

porphyry5 04-21-2013 02:10 PM

Quote:

Originally Posted by PierreB. (Post 4935489)
Hi LQ'ers,
Code:

konsole -e sudo -u rtorrent konsole -e rtorrent
The wall command allow me to ensure the script was really launched at startp, and it did but nothing happened after....

If konsole is like xterm, I believe you can have only one -e option, which must be the last option

PierreB. 04-21-2013 03:14 PM

Hi porphyry5,

Thank you for taking time to answer me.

I am sure you are right about the -e konsole options, and actually i was trying to launch one konsole instance and then from this first instance sudo'ing to another user to launch the second konsole in which rtorrent should be ran...

Way to complicated, as i was not able to achieve this, i simplified the problem by using only one user.

But i still can't get it works... I am now just trying to launch a konsole to which i pass rtorrent as a command to run, but still no luck, the issue is now for me to make rtorrent to get the required parameters to run as i expect it to run, but this is another story.

Once i will fix this rtorrent issue i'll try to launch the konsole at startup with the rtorrent argument to the -e option and see if it runs.


I'll come back here to give some (good?) news about my progress.

PierreB. 04-21-2013 03:45 PM

Ok, so i finally fix this the best way : just added a
Code:

konsole --workdir /path/to/dir -e rtorrent
, and that's it...

Thanks for your support.


All times are GMT -5. The time now is 09:37 PM.