Author Topic: Delete cronjob users via API  (Read 396 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Delete cronjob users via API
« on: March 28, 2024, 05:14:20 AM »
The API docs says to send:

key:   Key authorized by Api administrator
action: del
user:   User owners of the scheduled tasks
execute:   Frequency with which to execute the cron Example: * * * * * *
command:   Command to execute, Example: /usr/bin/php test.php
debug:   (0 / 1) Debug display file: /var/log/cwp/cwp_api.log

How do you specify which line or command to delete? Do you just send the execute and command lines to determine this?
PLEASE REMOVE CAPTCHA.. IT'S ANCIENT AND A MASSIVE TIME WASTE BAD EXPERIENCE FOR USERS. THE MATH SOLUTION IS SUFFICIENT. OR HAVE IT ONCE AND REMEMBER IF I'M A HUMAN

Online
****
Re: Delete cronjob users via API
« Reply #1 on: March 28, 2024, 06:23:05 PM »
I'm curious why you would delete user accounts via a cronjob? It's such a rare event on my servers that I would never automate it -- better to have the surety of manually deleting & confirming. In fact, I have ample server resources so I usually just suspend the account for at least a couple of months before coming later and cleaning up the user account. (Just in case the user returns or needs something off the account.)

Offline
*
Re: Delete cronjob users via API
« Reply #2 on: March 29, 2024, 04:43:14 PM »
This is not deleting the account. It's specific to user cron tabs. To add cron tasks and the purpose is to delete duplicates that occurred on my software.
PLEASE REMOVE CAPTCHA.. IT'S ANCIENT AND A MASSIVE TIME WASTE BAD EXPERIENCE FOR USERS. THE MATH SOLUTION IS SUFFICIENT. OR HAVE IT ONCE AND REMEMBER IF I'M A HUMAN

Online
****
Re: Delete cronjob users via API
« Reply #3 on: March 29, 2024, 05:12:51 PM »
Okay, I see what you're trying to accomplish. I would say the same thing re: user crontabs -- probably requires manual review before deletion. But that's just an opinion after 5 years with CWP, 15 years with cPanel before that. Most of my users don't know what a crontab is so I have very few user-level cron jobs in place on my servers. Unless you are facing buggy software that is auto-duplicating cron jobs and you are trying to de-duplicate... Care to share a concrete example?

Offline
*
Re: Delete cronjob users via API
« Reply #4 on: April 01, 2024, 02:59:49 PM »
Thanks for the replies.

Yes sure.

I have a few extra cron jobs for a user. With the API I can send a command to the server (as I have many) running the software for the users. They don't have access to the server. Only to the software via the browser.

So they don't know about these cron jobs as they just use the software.

But the set up script for the software accidentally created multiple cron jobs as it was stuck on that step. So I if I need to delete them, what command would I send was my question as it wasn't clear?

By the way, I think it worked by sending the cron job timing * * * * * and the command /usr/local/bin/php /home/dir/script.php
PLEASE REMOVE CAPTCHA.. IT'S ANCIENT AND A MASSIVE TIME WASTE BAD EXPERIENCE FOR USERS. THE MATH SOLUTION IS SUFFICIENT. OR HAVE IT ONCE AND REMEMBER IF I'M A HUMAN