Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 4 of 4

This is a discussion on Is there any way to prevent cPanel\WHM in the VPS & Dedicated forum
From adding dcpumon to the cron file? thisisit3 made a wonderful post a few years back explaining what it is, what it does, and how ...

  1. #1
    JPC Senior Member
    Join Date
    Feb 2007
    Posts
    80

    Question Is there any way to prevent cPanel\WHM

    From adding dcpumon to the cron file?

    thisisit3 made a wonderful post a few years back explaining what it is, what it does, and how to disable it: dcpumon - the ghost!


    The problem is that every time cPanel\WHM updates it puts this blasted thing back in the cron file making my site run like dog crap until I go back in and remove it.

    Is there any way that I can tell cPanel to stop adding it back in when it updates?

    I'd appreciate any advice.

    And yes, I know that "getting rid of cPanel" would be the easiest way to do it, but I have other less technically savvy folks that I rely on to help run my site and they kind of need the training wheels...

    Thanks in advance.

  2. #2
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,312
    You could run a script as a cron job yourself with a sed command to remove the line from the file.

    The script with the sed command would look somethin like
    Code:
    crontab -l > filename
    sed -i "/SomeUniquePartOfTheLine/d" filename
    crontab -r
    crontab filename
    where
    SomeUniquePartOfTheLine is text from the line that is unique to that line, and
    filename is a temporary workfile.

    The first line gets a copy of the current cron tab into filename.
    The next line removes the offending line.
    The third line deletes the current crontab.
    The last line installs the modified filename as the new crontab.

    I don't know how big your crontab is, and I don't know what happens when a cronjob removes the crontab it is running from. In other words, save a copy of your crontab before you start and test test test.

    Your mileage may vary.
    Good luck!
    Good luck

  3. #3
    JPC Senior Member
    Join Date
    Feb 2007
    Posts
    80
    Quote Originally Posted by Ron View Post
    You could run a script as a cron job yourself with a sed command to remove the line from the file.

    The script with the sed command would look somethin like
    Code:
    crontab -l > filename
    sed -i "/SomeUniquePartOfTheLine/d" filename
    crontab -r
    crontab filename
    where
    SomeUniquePartOfTheLine is text from the line that is unique to that line, and
    filename is a temporary workfile.

    The first line gets a copy of the current cron tab into filename.
    The next line removes the offending line.
    The third line deletes the current crontab.
    The last line installs the modified filename as the new crontab.

    I don't know how big your crontab is, and I don't know what happens when a cronjob removes the crontab it is running from. In other words, save a copy of your crontab before you start and test test test.

    Your mileage may vary.
    Good luck!

    Thanks for the response. I wondered if that were an option, but like yourself, the part in bold is a big "X" factor; just what *would* the consequences be in that regard?

    Hmmm...

  4. #4
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,312
    Well, at worst I'd guess that dcpumon would still be running and your crontab would be lost.

    There are several ways I'd try to test this; perhaps add a command of
    Code:
    sleep 3
    at the beginning of the script to ensure the calling script (the one called from crontab) had completed before beginning work on crontab.
    and call it with something like "nohup scriptname&" from cron.

    Or to go a level deeper, create the cron script file to execute (and exit) the real workhorse script (the one from the previous post).

    Alternatively, you might be brave and directly modify the contab file inside /var/spool/cron/ , but I wouldn't recommend that.

    Perhaps one of the JPC sysadmins will wander into the forums and has done something like this, or is bored and can think about it for a minute?
    Good luck

Bookmarks

Posting Permissions

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