aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Cron?  (Read 5376 times)

Nuke

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 13
Cron?
« on: April 22, 2004, 09:07:18 PM »

Hi... Since I'm conditioned by my ISP to national traffic, I need to use IP filter but, between 4 and 7 am, I have no limits so, I'd like to be able to remove the IP filter. Someone once told me about a program called cron. Can I do something like shutdown amule at 4am, move the ip filter file to another folder and run amule again. At 7am, shutdown, move back IP filter and run amule?
Logged

stefanero

  • Some Support
  • Developer
  • Hero Member
  • *****
  • Karma: 8
  • Offline Offline
  • Posts: 4235
Re: Cron?
« Reply #1 on: April 23, 2004, 08:02:11 AM »

yup

that is true ;)

try        man cron

to find out more ;)
just make shure that you export your display when you restart amule in cron, otherwise it won't work

stefanero
Logged
In its default setup, Windows XP on the Internet amounts to a car
parked in a bad part of town, with the doors unlocked, the key in
the ignition and a Post-It note on the dashboard saying, "Please
don't steal this."

djoole

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 21
Re: Cron?
« Reply #2 on: May 11, 2004, 07:11:29 PM »

Quote
Originally posted by stefanero
just make shure that you export your display when you restart amule in cron, otherwise it

I'm interested in what you mean, cause my  aMule-2.0.0rc3 closes itself very often, without any particular reason.
I had the idea to put it in the crontab to make it launch every hour.

So i did while logged as user :
crontab -e
And added the following line :
0 * * * * /usr/bin/amule

And indeed, in the syslog i see cron launching every hour /usr/bin/amule, but it seems it doesn't really launch it.. No amule running.

What's the problem?
Logged

deltaHF

  • Evil Admin
  • Former Developer
  • Hero Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 3920
  • .. Legends may sleep, but they never die ..
    • http://www.amule.org

stefanero

  • Some Support
  • Developer
  • Hero Member
  • *****
  • Karma: 8
  • Offline Offline
  • Posts: 4235
Re: Cron?
« Reply #4 on: May 11, 2004, 07:23:52 PM »

hey

since cron is a system job it can't access your display where KDE is running for example.
so oyu have to disable access control for your display
$xhost +
will disable any control (so maybe not the best idear ;) )
and in your cron job you have to add
$export "DISPLAY=localhost:0"
and I think thats it ;)
I am not 100% sure but should work

stefanero
Logged
In its default setup, Windows XP on the Internet amounts to a car
parked in a bad part of town, with the doors unlocked, the key in
the ignition and a Post-It note on the dashboard saying, "Please
don't steal this."

djoole

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 21
Re: Cron?
« Reply #5 on: May 11, 2004, 07:55:58 PM »

OK Stefanero, gonna try that.

Btw... the "test" shell command doesn't function, not returning anything. Do i miss something?
« Last Edit: May 11, 2004, 07:57:18 PM by djoole »
Logged

djoole

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 21
Re: Cron?
« Reply #6 on: May 11, 2004, 08:01:08 PM »

Nice! It works, i just added "env DISPLAY=:0.0" before my cron command.
I didn't have to do the $xhost+ command.

Now i have this line in my crontab :
0 * * * * env DISPLAY=:0.0 /usr/bin/amule > /home/julien/cronlogs/clear_temp_dir.txt  >/dev/null 2>&1

aMule starts every hour now. Don't know what happens if it's already running thou :-?
Logged

Jacobo221

  • Hero Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 2712
Re: Cron?
« Reply #7 on: May 11, 2004, 11:33:36 PM »

if it's already runnin, it won't be started again.
aMule checks at startup if that user is already running som eother instance of aMule. If he/she is running it, then it closes itself and lets the other continue running.
Anyway, I think the scripts DeltaHF told you suit better your needs ;-)
Greetings.
Logged

djoole

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 21
Re: Cron?
« Reply #8 on: May 12, 2004, 12:51:29 AM »

yup maybe, but as mentionned above,  the "test" command doesn't work on my comp (MDK10). Anyway, i set the cron command for every 30 minutes, t's ok
Logged

Jacobo221

  • Hero Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 2712
Re: Cron?
« Reply #9 on: May 12, 2004, 12:57:56 AM »

well, this will surely work on bash then:
   while true; do amule; done
;-)
It avoid aMule to be starded every x minutes, instead, it will be restarted when it crashes. But you'll have to kill the bash shell, not only aMule, whenever you want to cleanly close aMule.
Greetings!
Logged