Find the answer to your Linux question:
Results 1 to 9 of 9
I want to set up a cron job to run this series of commands... Code: xterm -e "emerge sync && emerge -uDN && emerge depclean && revdep-rebuild" I've heard this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586

    Need help setting up a cron job for updating


    I want to set up a cron job to run this series of commands...
    Code:
    xterm -e "emerge sync && emerge -uDN && emerge depclean && revdep-rebuild"
    I've heard this (the series of emerge commands and revdep-rebuild) is the most effective way of doing it, as it syncs, updates, removes unnecessary files, and fills in any files that might have been needed when removing unnecessary files.

    so, what would i add to this command to make a non-root user run this (since only root can run emerge)? or, is there another way to allow a non-root user to run this? also, does this command look like it would work well...it did when i opened xterm, logged in as root, then typed the command exactly as is.

    i really don't want to restart into X as a root each night so that i can run a cron job...i'm sure i would forget most of the time.

    i've been looking for an answer to this for a while. i even looked through xterm's really long man pages for a command that might allow me to use root temporarily, but as i was rushing through it (the man pages are huge) i might've missed it if there is one. or maybe there isn't one..?

    thanks in advance!

  2. #2
    Linux Guru budman7's Avatar
    Join Date
    Oct 2004
    Location
    Knee deep in Grand Rapids, Michigan
    Posts
    3,242
    Make your regular user a member of the portage group. Then your regular user should be able to use emerge.
    How to know if you are a geek.
    when you respond to "get a life!" with "what's the URL?"
    - Birger

    New users read The FAQ

  3. #3
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586
    Quote Originally Posted by budman7
    Make your regular user a member of the portage group. Then your regular user should be able to use emerge.
    I've never added a user to another group yet, but after reading up some it looks like I would do it like this....?
    Code:
    usermod -G portage user
    does that look right?

    thanks for helping me!

    EDIT: that looks like it worked!

  4. #4
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586
    Quote Originally Posted by josolanes
    Quote Originally Posted by budman7
    Make your regular user a member of the portage group. Then your regular user should be able to use emerge.
    I've never added a user to another group yet, but after reading up some it looks like I would do it like this....?
    Code:
    usermod -G portage user
    does that look right?

    thanks for helping me!

    EDIT: that looks like it worked!
    correction (looking back)...i think i was supposed to type all of the groups i want this user under, as i now can't "su -" into root

    i'll log in as root in another screen to fix this. i think i should've payed a little more attention

    EDIT: yep, that fixed it...now i can log in as root again

  5. #5
    Just Joined!
    Join Date
    May 2005
    Location
    Huntington Beach, CA USA
    Posts
    22
    To add yourself to another group such as audio for example you would type gpasswd -a user audio.

    You would replace user with your user name.

    BTW, I think you would need to add the cron job as root or set your gentoo box with sudo. Although I would suggest you avoid doing what you are planning regularly as it is likely to break something on your box.

  6. #6
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586
    Quote Originally Posted by ginsuedog
    To add yourself to another group such as audio for example you would type gpasswd -a user audio.

    You would replace user with your user name.

    BTW, I think you would need to add the cron job as root or set your gentoo box with sudo. Although I would suggest you avoid doing what you are planning regularly as it is likely to break something on your box.
    would it really break it?

    how would it break it? one of the commands not running correctly?

    what set of commands would you recommend running? it just takes so long to update sometimes (if it's updating something huge like openoffice or xorg-x11)

    thanks for bringing that up!

  7. #7
    Just Joined!
    Join Date
    May 2005
    Location
    Huntington Beach, CA USA
    Posts
    22
    Well I know that doing a deep clean on a Gentoo box is a very risky business for one Portage isn't perfect and sometimes a deep clean will remove a very important package that you need. Search the gentoo forums and you will see what I mean.

  8. #8
    Just Joined!
    Join Date
    May 2005
    Location
    Huntington Beach, CA USA
    Posts
    22
    The best way is to simply run your updates every few days. That way you do not have that many updates to compile at once. Most of the time you do not need to run with a --deep option. I have a cron job setup to run emerge --sync daily at 6:30am and then I normally just run emerge --update world every few days. Most of the time it doesn't take that long,maybe 20 to 30 minutes tops unless it is something big. Try emerge -av ccache, it will help speed you up somewhat.

  9. #9
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586
    thanks for the advice

    i'll update every few days...sounds like a good idea.

    ...and i'll deep clean every few weeks possibly. running it too often, i guess it can cause problems. i'll read up more on it soon.

    thanks again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •