PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > linux.debian.user > How do you turn on and off a program automatcially
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
linux.debian.user debian-user@lists.debian.org.

How do you turn on and off a program automatcially

Réponse
 
LinkBack Outils de la discussion
Vieux 28/09/2007, 22h50   #1
Sid Arth
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How do you turn on and off a program automatcially

Hi, I am running rtorrent and I was wondering if it is possible for the
system to turn the program off at certain times, and turn it back on at
other times.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 28/09/2007, 23h30   #2
Peter Smerdon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG/XBRowvbDpiw8RERAkByAJ92UAAM8zt7r5LnQ3RXtcNJ0882oQC fZaa9
n6TfNEr0dDJGyx7jQ7NCejE=
=hKO3
-----END PGP SIGNATURE-----
  Réponse avec citation
Vieux 30/09/2007, 19h42   #3
Celejar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On Fri, 28 Sep 2007 17:21:16 -0400
Peter Smerdon <psmerdon@magma.ca> wrote:

> Sid Arth <sidster802@gmail.com> writes:
>
> > Hi, I am running rtorrent and I was wondering if it is possible for the
> > system to turn the program off at certain times, and turn it back on at
> > other times.

>
> You can probably use use `cron' to achieve this.


I struggled for a while to figure out how to do exactly this, without
success. I believe that cron does not work, since (at least some)
ncurses apps insist on being run from a terminal.

> Peter Smerdon
> psmerdon@magma.ca


Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 30/09/2007, 20h30   #4
ndemou@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On 9/30/07, Celejar <celejar@gmail.com> wrote:
> On Fri, 28 Sep 2007 17:21:16 -0400
> Peter Smerdon <psmerdon@magma.ca> wrote:
>
> > Sid Arth <sidster802@gmail.com> writes:
> >
> > > Hi, I am running rtorrent and I was wondering if it is possible for the
> > > system to turn the program off at certain times, and turn it back on at
> > > other times.

> >
> > You can probably use use `cron' to achieve this.

>
> I struggled for a while to figure out how to do exactly this, without
> success. I believe that cron does not work, since (at least some)
> ncurses apps insist on being run from a terminal.



usually such problems have to do with the differences of the
environment (bash variables) - you can customize the env. of cron to
overcome this problem


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 30/09/2007, 23h10   #5
Celejar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On Sun, 30 Sep 2007 21:17:57 +0300
ndemou@gmail.com wrote:

> On 9/30/07, Celejar <celejar@gmail.com> wrote:
> > On Fri, 28 Sep 2007 17:21:16 -0400
> > Peter Smerdon <psmerdon@magma.ca> wrote:
> >
> > > Sid Arth <sidster802@gmail.com> writes:
> > >
> > > > Hi, I am running rtorrent and I was wondering if it is possible for the
> > > > system to turn the program off at certain times, and turn it back on at
> > > > other times.
> > >
> > > You can probably use use `cron' to achieve this.

> >
> > I struggled for a while to figure out how to do exactly this, without
> > success. I believe that cron does not work, since (at least some)
> > ncurses apps insist on being run from a terminal.

>
>
> usually such problems have to do with the differences of the
> environment (bash variables) - you can customize the env. of cron to
> overcome this problem


I don't currently have rtorrent installed, but can you give a bit more
explanation or a pointer for future reference? What differences in the
environment do you mean? Which variables have to be modified, and to
what values?

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 30/09/2007, 23h20   #6
Ralph Katz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On 09/28/2007 05:21 PM, Peter Smerdon wrote:
> Sid Arth <sidster802@gmail.com> writes:
>
>> Hi, I am running rtorrent and I was wondering if it is possible for the
>> system to turn the program off at certain times, and turn it back on at
>> other times.

>
> You can probably use use `cron' to achieve this.


This may to start:
$ man at
and perhaps a script could be run to kill it as well, but I wouldn't
know about graceful exits with that.

Regards,
Ralph


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 01/10/2007, 12h10   #7
Bhasker C V
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

All,

Even if we solve this by going for an alternative approach as to using
a text based program, we still need a method by which we can run some
curses based application
For this we can use "screen" (man screen)
Open a new terminal and then run the program
After running this program, we can use cron to send
***** kill -STOP <pid>
***** kill -CONT <pid>
change (*****) with the cron timing which seuits you. This way we can
start and stop the program at will.

On Sun, 2007-09-30 at 17:07 -0400, Celejar wrote:
> On Sun, 30 Sep 2007 21:17:57 +0300
> ndemou@gmail.com wrote:
>
> > On 9/30/07, Celejar <celejar@gmail.com> wrote:
> > > On Fri, 28 Sep 2007 17:21:16 -0400
> > > Peter Smerdon <psmerdon@magma.ca> wrote:
> > >
> > > > Sid Arth <sidster802@gmail.com> writes:
> > > >
> > > > > Hi, I am running rtorrent and I was wondering if it is possible for the
> > > > > system to turn the program off at certain times, and turn it back on at
> > > > > other times.
> > > >
> > > > You can probably use use `cron' to achieve this.
> > >
> > > I struggled for a while to figure out how to do exactly this, without
> > > success. I believe that cron does not work, since (at least some)
> > > ncurses apps insist on being run from a terminal.

> >
> >
> > usually such problems have to do with the differences of the
> > environment (bash variables) - you can customize the env. of cron to
> > overcome this problem

>
> I don't currently have rtorrent installed, but can you give a bit more
> explanation or a pointer for future reference? What differences in the
> environment do you mean? Which variables have to be modified, and to
> what values?
>
> Celejar
> --
> mailmin.sourceforge.net - remote access via secure (OpenPGP) email
> ssuds.sourceforge.net - A Simple Sudoku Solver and Generator
>
>

--
Bhasker C V
Registered Linux user: #306349 (counter.li.org)
The box said "Requires Windows 95, NT, or better", so I installed Linux.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 01/10/2007, 14h00   #8
ndemou@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On 10/1/07, Celejar <celejar@gmail.com> wrote:
> On Sun, 30 Sep 2007 21:17:57 +0300
> ndemou@gmail.com wrote:
> > On 9/30/07, Celejar <celejar@gmail.com> wrote:
> > > [...]
> > > I struggled for a while to figure out how to do exactly this, without
> > > success. I believe that cron does not work, since (at least some)
> > > ncurses apps insist on being run from a terminal.

> >
> >
> > usually such problems have to do with the differences of the
> > environment (bash variables) - you can customize the env. of cron to
> > overcome this problem

>
> I don't currently have rtorrent installed, but can you give a bit more
> explanation or a pointer for future reference? What differences in the
> environment do you mean? Which variables have to be modified, and to
> what values?


if you enter the "set" command in bash you get a list of bash
variables that are accessible to all programms that you execute. This
is called "the bash environment" (see [1] for more info). A lot of
programms really need to check the values of some of these variables
to execute. Cron has only a small portion of them set so a lot of
programms fail when run from cron (can't tell if this is your specific
case though)

_____________
[1] http://tldp.org/LDP/Bash-Beginners-G...l/chap_03.html


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 01/10/2007, 15h30   #9
Douglas A. Tutty
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On Mon, Oct 01, 2007 at 02:59:41PM +0300, ndemou@gmail.com wrote:
> On 10/1/07, Celejar <celejar@gmail.com> wrote:
> > On Sun, 30 Sep 2007 21:17:57 +0300
> > ndemou@gmail.com wrote:
> > > On 9/30/07, Celejar <celejar@gmail.com> wrote:
> > > > [...]
> > > > I struggled for a while to figure out how to do exactly this, without
> > > > success. I believe that cron does not work, since (at least some)
> > > > ncurses apps insist on being run from a terminal.
> > >


> if you enter the "set" command in bash you get a list of bash
> variables that are accessible to all programms that you execute. This
> is called "the bash environment" (see [1] for more info). A lot of
> programms really need to check the values of some of these variables
> to execute. Cron has only a small portion of them set so a lot of
> programms fail when run from cron (can't tell if this is your specific
> case though)


What if you have cron run su - [user]? That should set up a login
environment.

Doug.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 01/10/2007, 23h50   #10
Henrique G. Abreu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

I know that it's not what you asked but may solve your problem.
I understand that you want to regulate the download time of your torrents
I don't know rtorrent, but there is many that you can schedule download time and
Bandwidth usage per hour, weekday, etc. (eg: Azureus)

--
Henrique G. Abreu
henrique@turbokit.com.br


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 08/10/2007, 19h30   #11
Celejar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On Mon, 1 Oct 2007 09:26:55 -0400
"Douglas A. Tutty" <dtutty@porchlight.ca> wrote:

> On Mon, Oct 01, 2007 at 02:59:41PM +0300, ndemou@gmail.com wrote:
> > On 10/1/07, Celejar <celejar@gmail.com> wrote:
> > > On Sun, 30 Sep 2007 21:17:57 +0300
> > > ndemou@gmail.com wrote:
> > > > On 9/30/07, Celejar <celejar@gmail.com> wrote:
> > > > > [...]
> > > > > I struggled for a while to figure out how to do exactly this, without
> > > > > success. I believe that cron does not work, since (at least some)
> > > > > ncurses apps insist on being run from a terminal.
> > > >

>
> > if you enter the "set" command in bash you get a list of bash
> > variables that are accessible to all programms that you execute. This
> > is called "the bash environment" (see [1] for more info). A lot of
> > programms really need to check the values of some of these variables
> > to execute. Cron has only a small portion of them set so a lot of
> > programms fail when run from cron (can't tell if this is your specific
> > case though)

>
> What if you have cron run su - [user]? That should set up a login
> environment.


I tried (using at) 'su - username mc' and received a mail stating:

su: must be run from a terminal

> Doug.


Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 08/10/2007, 19h40   #12
David Brodbeck
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially


On Oct 8, 2007, at 10:23 AM, Celejar wrote:

> On Mon, 1 Oct 2007 09:26:55 -0400
> "Douglas A. Tutty" <dtutty@porchlight.ca> wrote:
>
>> On Mon, Oct 01, 2007 at 02:59:41PM +0300, ndemou@gmail.com wrote:
>>> On 10/1/07, Celejar <celejar@gmail.com> wrote:
>>>> On Sun, 30 Sep 2007 21:17:57 +0300
>>>> ndemou@gmail.com wrote:
>>>>> On 9/30/07, Celejar <celejar@gmail.com> wrote:
>>>>>> [...]
>>>>>> I struggled for a while to figure out how to do exactly this,
>>>>>> without
>>>>>> success. I believe that cron does not work, since (at least
>>>>>> some)
>>>>>> ncurses apps insist on being run from a terminal.
>>>>>

>>
>>> if you enter the "set" command in bash you get a list of bash
>>> variables that are accessible to all programms that you execute.
>>> This
>>> is called "the bash environment" (see [1] for more info). A lot of
>>> programms really need to check the values of some of these variables
>>> to execute. Cron has only a small portion of them set so a lot of
>>> programms fail when run from cron (can't tell if this is your
>>> specific
>>> case though)

>>
>> What if you have cron run su - [user]? That should set up a login
>> environment.

>
> I tried (using at) 'su - username mc' and received a mail stating:
>
> su: must be run from a terminal


I missed most of this thread, so this may not be what you're looking
for, but has anyone suggested "rungetty", yet?

Package: rungetty
State: not installed
Version: 1.2-10
Priority: optional
Section: admin
Maintainer: Gerfried Fuchs <alfie@debian.org>
Uncompressed Size: 77.8k
Depends: libc6 (>= 2.3.6-6)
Description: minimal console getty that can run any process
rungetty might be the getty you were looking for. It is able to run any
program, not just login. If a different program than login is used it
usually
is run as nobody:nogroup, or the user/group specified on the
commandline.
rungetty can even be configured to autologin, under certain
circumstances. See
the manual page for more information.
You have to change some lines in /etc/inittab for having any effect
after
installing the package. rungetty is based on mingetty and therefore not
suitable for serial use.





--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 08/10/2007, 20h10   #13
Celejar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On Mon, 8 Oct 2007 10:33:53 -0700
David Brodbeck <brodbd@u.washington.edu> wrote:

>
> On Oct 8, 2007, at 10:23 AM, Celejar wrote:
>
> > On Mon, 1 Oct 2007 09:26:55 -0400
> > "Douglas A. Tutty" <dtutty@porchlight.ca> wrote:


[snip]

> >> What if you have cron run su - [user]? That should set up a login
> >> environment.

> >
> > I tried (using at) 'su - username mc' and received a mail stating:
> >
> > su: must be run from a terminal

>
> I missed most of this thread, so this may not be what you're looking
> for, but has anyone suggested "rungetty", yet?


[snip]

Thanks; we're looking for a way to run /control ncurses apps
non-interactively, e.g. via at or cron. Does rungetty for this?

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 09/10/2007, 05h30   #14
Douglas A. Tutty
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How do you turn on and off a program automatcially

On 9/30/07, Celejar <celejar@gmail.com> wrote:
> I struggled for a while to figure out how to do exactly this, without
> success. I believe that cron does not work, since (at least some)
> ncurses apps insist on being run from a terminal.


Lets get back to first principles then.

How does a curses app know if its being run from a terminal? I can't
read source and I don't have curses book handy so I'll guess:

TERM=

if it can look up that term in termcap/terminfo to see how to draw?

The value of tty?

Perhaps without an actual tty-type device it can't work?

---

If you do your at su - (I forget the syntax) command but have it echo
the env to a file, do you get a TERM set?

Perhaps create a script that sets TERM and then runs mc. Then have at
run that script?

Doug.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h36.


Édité par : vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,22708 seconds with 22 queries