Jump to content

Cron job for Urpmi


Recommended Posts

Good Morning,

 

I have been trying to set up a cron job for urpmi to update my sources (more an excercise in setting up cron jobs really) For learning purposes I am using Webmin to edit my cron jobs.

 

This is what I have:

 

/usr/sbin/urpmi.removemedia -a /usr/sbin/urpmi.addmedia --update updates ftp://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/updates/10.1/main_updates with media_info/hdlist.cz  /usr/sbin/urpmi.addmedia main ftp://gd.tuwien.ac.at/pub/linux/Mandrakelinux/official/10.1/i586/media/main with media_info/hdlist.cz  /usr/sbin/urpmi.addmedia contrib ftp://ftp.surfnet.nl/pub/os/Linux/distr/Mandrakelinux/official/10.1/i586/media/contrib with media_info/hdlist.cz  /usr/sbin/urpmi.addmedia plf ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/10.1 with hdlist.cz

 

This is the error I get:

 

Output from command /usr/sbin/urpmi.removemedia -a /usr/sbin/urpmi.addmedia --update updates ftp://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/updates/10.1/main_updates with media_info/hdlist.cz /usr/sbin/urpmi.addmedia main ftp://gd.tuwien.ac.at/pub/linux/Mandrakelinux/official/10.1/i586/media/main with media_info/hdlist.cz /usr/sbin/urpmi.addmedia contrib ftp://ftp.surfnet.nl/pub/os/Linux/distr/Mandrakelinux/official/10.1/i586/media/contrib with media_info/hdlist.cz /usr/sbin/urpmi.addmedia plf ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/10.1 with hdlist.cz ..


usage: urpmi.removemedia [-a] <name> ...
where <name> is a medium name to remove.
 --help         - print this help message.
 -a             - select all media.
 -c             - clean headers cache directory.
 -y             - fuzzy match on media names.
 -q             - quiet mode.
 -v             - verbose mode.

unknown options '--update'

 

Maybe based on what you see you can tell me why this is not working. I do not know, for instance, if you can place multiple command in a cron job (seems to me you would have to be able too) and if so, how do you seperate the commands? (ie with a ; or a , or just a space)

 

Finally, I know that webmin is just an interface for cron management, so it is adjusting an actual /etc/cron file, but I cannot find it in any of the cron directories. If I could see the actual file I am sure it would be helpful.

 

Thanks again,

Link to comment
Share on other sites

You need to enter each one seperately in webmin AFAIK

 

Each user has their own cron file so you will see different files for /you , /root, etc if they exist.

To see what your cron jobs look like open a consol and:

crontab -e

this will either show you your current jobs or create the file.

You could edit this file to look something like this:

# * * * * * /usr/sbin/urpmi.addmedia --update updates ftp://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/updates/10.1/main_updates with media_info/hdlist.cz
# * * * * * /usr/sbin/urpmi.addmedia main ftp://gd.tuwien.ac.at/pub/linux/Mandrakelinux/official/10.1/i586/media/main with media_info/hdlist.cz

etc, etc. then set up the times in webmin for each job.

 

More info on cron: http://mandrakeusers.org/old_docs/admin/acron2.html

Link to comment
Share on other sites

for some reason when I set up a cron job with webmin, it seems like it doesn't execute it. I have a cron job that is suppose to "updatedb" every time I boot, but it doesn't do it. Cause it'll say my database is old and I have to manually update it myself. There are other things I've set as a cron and webmin wont execute it.

Link to comment
Share on other sites

In regards to the original message that I posted, while it is true that webmin requires seperate entries, it was very easy to work aroung this. Pointing a cron process to a bash script solved my problem very nicely.

 

#!bash/sh

/usr/sbin/urpmi.removemedia -a;
/usr/sbin/urpmi.addmedia --update updates ftp://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/updates/10.
1/main_updates with media_info/hdlist.cz;
/usr/sbin/urpmi.addmedia main ftp://gd.tuwien.ac.at/pub/linux/Mandrakelinux/official/10.1/i586/media/main with media_in
fo/hdlist.cz;
/usr/sbin/urpmi.addmedia contrib ftp://ftp.surfnet.nl/pub/os/Linux/distr/Mandrakelinux/official/10.1/i586/media/contrib
with media_info/hdlist.cz;
/usr/sbin/urpmi.addmedia plf ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/10.1 with hdlist.cz

 

This has the added effect of making your crontab file easier and cleaner to read.

 

Don't ya just love automating tasks :banana:

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...