[Resolved] Add Auto Cron
Hi
i am developing a app for my clients for cpanel.. when a user login to cpanel and click a button which is added by me.. if that button is clicked i need to add a cron in that user's cpanel for eg
my user name is strt23
and i am login in to cpanel and clicked add cron in main page after clicking i need to view the cron added in my cpanel cron tab page
-
In order to find the API calls for cron, you'll need to look in /usr/local/cpanel/base/frontend/x3/cron. In that directory, we can find cron_entries.html which calls the tag to list cron tasks: This means that an API1/API2 call is in use. Here's the call in question: [url=http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiCron#Cron::listcron]Cron Module Documentation You can't ask for a specific cron entry so you'll have to get a list of all the cron entries and then loop through and find just the one you want and display it. 0 -
Thanks for your reply.. but i just need to add a new corn & if user changes the settings i need to update the same cron using php [quote="KostonConsulting, post: 1530332">In order to find the API calls for cron, you'll need to look in /usr/local/cpanel/base/frontend/x3/cron. In that directory, we can find cron_entries.html which calls the tag to list cron tasks: This means that an API1/API2 call is in use. Here's the call in question: [url=http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiCron#Cron::listcron]Cron Module Documentation You can't ask for a specific cron entry so you'll have to get a list of all the cron entries and then loop through and find just the one you want and display it. 0 -
To add a cron task, use the add_line API call: [url=http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiCron#Cron::add_line]Cron Module Documentation You can use the cPanel PHP API class: So, in order to add the cron task, use Cron::add_line() and then use Cron::list_cron() to get all cron entries. Then loop through and find the line that was previously added and use Cron::edit_line() to edit it: [url=http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiCron#Cron::edit_line]Cron Module Documentation 0
Please sign in to leave a comment.
Comments
3 comments