Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Nov 2001
    Posts
    455

    Default Possible to run auto-add cron task with WHM plugin?

    Hello,

    I am thinking about developing a WHM plugin, but it would need to run once every day.

    Is there a way to automatically add a task to cron when "installing" a plugin?

    The problem is that the target market of this plugin is newbie resellers and server owners.. and they might not be able to figure out how to add something to cron.

    (ie: It's hard enough to explain how to "install" a WHM plugin.. and asking them to fiddle with cron is very difficult. Thus, I'd prefer if there is some way to automate this step?)

    I hope that makes sense.
    I am an eNom ETP.
    Sign up today if you want an eNom.com domain reseller account from a reliable provider.
    * We now provide support and service to over 3250 happy resellers!

  2. #2
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,554
    cPanel/Enkompass Access Level

    DataCenter Provider

    Lightbulb

    Quote Originally Posted by electric View Post
    I am thinking about developing a WHM plugin, but it would need to run once every day.

    Is there a way to automatically add a task to cron when "installing" a plugin?
    This type of action, to add a cron job or modify a crontab, may be performed by the custom script used to install the custom plug-in. To have a cron entry run just once a day, the entry could be added as a file in the following directory:
    Code:
    /etc/cron.daily/

  3. #3
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Well, as plugins have no real unified installation method at this time there isn't a way to do this. However you could always do a touch file to check if it's run for the first time or not.


    f.ex (pseudo code):

    if ( !-e /var/cpanel/$yourplugin/.notfirsttime ) {
    install cron
    do some setup stuff
    touch /var/cpanel/$yourplugin/.notfirsttime
    }
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

Similar Threads & Tags
Similar threads

  1. Replies: 24
    Last Post: 11-23-2010, 08:44 PM
  2. How to make an appointment a task in cron every 3 days?
    By romzinho in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-15-2007, 06:42 PM
  3. Replies: 3
    Last Post: 03-29-2007, 05:31 AM
  4. how to add a cron in whm
    By docesam in forum New User Questions
    Replies: 1
    Last Post: 01-05-2007, 01:45 PM
  5. Cannot Schedule Cron Awstats Update Task
    By stewartn in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-13-2004, 11:19 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube