Re: Screen inside Jails + su

2008-04-09 Thread Erik Osterholm
On Wed, Apr 09, 2008 at 03:05:03AM +0200, Wael Nasreddine wrote:
 This One Time, at Band Camp, Erik Osterholm [EMAIL PROTECTED] said, On Tue, 
 Apr 08, 2008 at 07:52:17PM -0500:
  On Wed, Apr 09, 2008 at 12:00:05AM +0200, Wael Nasreddine wrote:
 
  The common way for a user to run a program at startup is to use
  cron with the special @reboot directive instead of giving it a
  time to run a job.
  http://www.freebsd.org/doc/en/books/handbook/configtuning-starting-services.html
 
 Thank you for pointing that out, could you please give me an example
 I haven't found on that page...
 
Sure.

At your shell prompt, type:
man 5 crontab

You'll find the man page for the crontab file, which includes multiple
examples of cron entries.  All of those use the time specification,
though, rather than the @reboot keyword.

An example using @reboot:
@reboot /usr/local/bin/screen -d -m Rtorrent

You can edit the crontab for the user with this command at your shell
prompt:
crontab -u username -e

This will dump you into your editor, editing the crontab file for the
user username.  Type in the crontab entry (for example, the one I
used as an example above), save, and try restarting the jail.

Erik
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Screen inside Jails + su

2008-04-09 Thread Wael Nasreddine
This One Time, at Band Camp, Erik Osterholm [EMAIL PROTECTED] said, On Wed, 
Apr 09, 2008 at 01:42:16PM -0500:
 Sure.

 At your shell prompt, type:
 man 5 crontab

 You'll find the man page for the crontab file, which includes multiple
 examples of cron entries.  All of those use the time specification,
 though, rather than the @reboot keyword.

 An example using @reboot:
 @reboot   /usr/local/bin/screen -d -m Rtorrent

 You can edit the crontab for the user with this command at your shell
 prompt:
 crontab -u username -e

 This will dump you into your editor, editing the crontab file for the
 user username.  Type in the crontab entry (for example, the one I
 used as an example above), save, and try restarting the jail.

Thank you, I googled a bit yesterday actually and now it's working
perfectly :)

I use linux since 6 years and I've never seen this reboot command
actually, but I'm used to cron, but thanks a lot for pointing this out,
it's very useful :)

 Erik

-- 
Wael Nasreddine
http://wael.nasreddine.com
PGP: 1024D/C8DD18A2 06F6 1622 4BC8 4CEB D724  DE12 5565 3945 C8DD 18A2

/o\ The mark of a good party is that you wake up the next morning wanting to
/o\ change your name and start a new life in different city.
/o\   -- Vance Bourjaily, Esquire


pgpSOWrzq8yz7.pgp
Description: PGP signature


Screen inside Jails + su

2008-04-08 Thread Wael Nasreddine
Hello,

I have a FreeBSD server which is Jails based, I have created a special
jail to run 3 rTorrent process for 3 users, I made all the permissions
and added the users, then I launched manually (for testing purpose)
these screen sessions for the 3 users using the below method:
- jexec onto the jail.
- su to the user: su -l wael
- run a detached screen: screen -dmS Rtorrent
  I have a .screenrc for each user in place to run one command,
  rtorrent

Now I have 2 questions:
1) How can I add this procedure to the jail startup??
2) I can't attach the screen, everytime I try to I get an error:
 # su -l wael
 % screen -Dr Rtorrent
 Cannot open your terminal '/dev/ttyp6' - please check.
  What's going on? why can't I attach the screen session ??

Thanks :)

-- 
Wael Nasreddine
http://wael.nasreddine.com
PGP: 1024D/C8DD18A2 06F6 1622 4BC8 4CEB D724  DE12 5565 3945 C8DD 18A2

/o\ I had a friend who was ready for a memory upgrade on his Mac notebook, 
and he
/o\ wanted to know how much megaram he needed.


pgp42A1CxBSNK.pgp
Description: PGP signature


Re: Screen inside Jails + su

2008-04-08 Thread Erik Osterholm
On Wed, Apr 09, 2008 at 12:00:05AM +0200, Wael Nasreddine wrote:
 Hello,
 
 I have a FreeBSD server which is Jails based, I have created a special
 jail to run 3 rTorrent process for 3 users, I made all the permissions
 and added the users, then I launched manually (for testing purpose)
 these screen sessions for the 3 users using the below method:
 - jexec onto the jail.
 - su to the user: su -l wael
 - run a detached screen: screen -dmS Rtorrent
   I have a .screenrc for each user in place to run one command,
   rtorrent
 
 Now I have 2 questions:
 1) How can I add this procedure to the jail startup??

The common way for a user to run a program at startup is to use cron
with the special @reboot directive instead of giving it a time to run
a job.
http://www.freebsd.org/doc/en/books/handbook/configtuning-starting-services.html


 2) I can't attach the screen, everytime I try to I get an error:
  # su -l wael
  % screen -Dr Rtorrent
  Cannot open your terminal '/dev/ttyp6' - please check.
   What's going on? why can't I attach the screen session ??

If you have used jexec to get into the jail, then you won't have a pty
within the jail, and anything which relies on one will fail to
execute.  Start up sshd in the jail, then ssh to it and see if you can
attach the screen.
 
Erik
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Screen inside Jails + su

2008-04-08 Thread Wael Nasreddine
This One Time, at Band Camp, Erik Osterholm [EMAIL PROTECTED] said, On Tue, 
Apr 08, 2008 at 07:52:17PM -0500:
 On Wed, Apr 09, 2008 at 12:00:05AM +0200, Wael Nasreddine wrote:

 The common way for a user to run a program at startup is to use cron
 with the special @reboot directive instead of giving it a time to run
 a job.
 http://www.freebsd.org/doc/en/books/handbook/configtuning-starting-services.html

Thank you for pointing that out, could you please give me an example I
haven't found on that page...

 If you have used jexec to get into the jail, then you won't have a pty
 within the jail, and anything which relies on one will fail to
 execute.  Start up sshd in the jail, then ssh to it and see if you can
 attach the screen.
Thanks that worked fine...

 Erik


-- 
Wael Nasreddine
http://wael.nasreddine.com
PGP: 1024D/C8DD18A2 06F6 1622 4BC8 4CEB D724  DE12 5565 3945 C8DD 18A2

/o\ Man has never reconciled himself to the ten commandments.


pgpoBmfKE50NM.pgp
Description: PGP signature