LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Reply
 
Search this Thread
Old 09-05-2005, 03:59 PM   #1
fast_rizwaan
Member
 
Registered: Oct 2002
Location: Hyderabad, India
Distribution: Slackware 10.1
Posts: 34

Rep: Reputation: 15
How to schedule *interactive* task with at or cron


I need to run bittorrent-curses and giFTcurs between 2am - 8am only for free unlimited download, except 2-8am bandwidth is too costly.

So, could you please advise me on how to run Interative programs like "bittorrent-curses" or "vi" or "pico", "emacs" etc., which requires user interaction like typing etc.,

The problem with at and cron (what I found upto now with googling) is that it won't run jobs interactively (really?) and only run task in backgound. I need to run the task interactively.

I use adsl-start and adsl-stop to start and stop internet connection.

To run vi
Code:
echo vi | at now + 1 min
After 1 minute Nothing shows up .


I want to run these commands adsl-start runs fine but bittorrent-curses won't run

Code:

echo /usr/sbin/adsl-start| at 0200
echo /usr/bin/bittorrent-curses ~/mytorrent.torrent| at 0201
same with crontab -e

Code:

#Run daily -> Start Internet connection at 2:00 AM
0 2 * * * /usr/sbin/adsl-start

#Run daily -> start bittorrent curses interface to download mytorrent.torrent file
1 2 * * * /usr/bin/bittorrent-curses ~/mytorrent.torrent

#Run daily -> Stop Internet connection at 8:00 AM
0 8 * * * /usr/sbin/adsl-stop

The adsl-start & adsl-stop works fine at 2:00am and 8:00am, but bittorrent-curses won't show up not even in ps -aux | grep bittorrent-curses .

I need to run interactive programs at a specific time, how could I do that? is there any way?

Last edited by fast_rizwaan; 09-05-2005 at 04:06 PM.
 
Old 09-05-2005, 04:17 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,527

Rep: Reputation: 177Reputation: 177
"I need to run interactive programs at a specific time, how could I do that? is there any way?"

You could try reading the required responses from a file:

/usr/bin/bittorrent-curses ~/mytorrent.torrent < all.the.answers.txt

---------------------------
Steve Stites
 
Old 09-07-2005, 05:21 PM   #3
fast_rizwaan
Member
 
Registered: Oct 2002
Location: Hyderabad, India
Distribution: Slackware 10.1
Posts: 34

Original Poster
Rep: Reputation: 15
Won't help

I want the "Curses" ncurses based application to come up in the foreground, as if you run it by typing bittorrent-curses on the shell.


ok forget bittorrent-curses, let's take "vi" editor,

how will you run vi editor using cron or at after 2 min. if you run vi using this command

echo vi | at now+2min

will successfully run the command but in background and it won't show up.


can you make it run "vi" as you'd run from bash sheel by typing vi???
 
Old 09-08-2005, 02:23 AM   #4
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
You can do something like this since the machine will run anyway:

Open a terminal (xterm, konsole or console login) and type this:
while [ `date +%H%M` -lt 200 -o `date +%H%M` -gt 800 ] ; do sleep 60 ; done ; adsl-start ; /usr/bin/bittorrent-curses ~/mytorrent.torrent

What this will do is this: every minute it checks if the time is between 02:00 AM and 08:00 AM and if it is it will stop the loop, run adsl-start and run bittorrent-curses. You can then use at to run adsl-stop at 08:00 AM, bittorrent will continue to run but without an internet connection there's nothing it can do :)
You can also add a "killall bittorrent-curses" to the at job at 08:00 AM to make sure bittorrent stops.

Greetings,
blindy

Last edited by blindcoder; 09-08-2005 at 02:25 AM.
 
Old 09-09-2005, 06:26 PM   #5
fast_rizwaan
Member
 
Registered: Oct 2002
Location: Hyderabad, India
Distribution: Slackware 10.1
Posts: 34

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by blindcoder
You can do something like this since the machine will run anyway:

Open a terminal (xterm, konsole or console login) and type this:
while [ `date +%H%M` -lt 200 -o `date +%H%M` -gt 800 ] ; do sleep 60 ; done ; adsl-start ; /usr/bin/bittorrent-curses ~/mytorrent.torrent


thanks blindy, that's what I've been asking for. I wanna give you a big HUG. "><" (yahoo smiley for hugging)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a cron task in a script Slith(++1) Programming 3 11-21-2005 04:17 AM
Trying to schedule ftp login using cron compuser Linux - General 2 06-10-2005 04:22 AM
Schedule a task ! L1nuxbug Linux - Networking 4 03-02-2005 07:54 PM
cron jobs work fine when invoked from webmin but fail on schedule jillu Linux - Enterprise 3 01-20-2005 01:34 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 09:57 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration