Hello, a question I can't answer. Is there any way to predefine a Cron task that already appears by default configured in all new accounts when creating them??
thanks
Yes, you can setup a custom bash script that makes use of the Cron::add_line cPanel API 2 function. Then, configure the custom bash script to automatically run during the account creation process as part of a post account creation hook. Here's some documentation to get you started:
Yes, you can setup a custom bash script that makes use of the Cron::add_line cPanel API 2 function. Then, configure the custom bash script to automatically run during the account creation process as part of a post account creation hook. Here's some documentation to get you started:
Thanks.
I created a hook (creating accoun) that creates the cron file with the lines in /var/spool/cron. I can see the task created in the client panel, but I don't know if there's anything else behind the scenes that escapes me. Would this approach also be valid or wouldn't run?
Yes, manually editing the /var/spool/cron/$username file is also a valid method of setting up the cron job. Note that if you are assigning the account "No Shell" or "Jailed Shell Access", the first line in the user's cron file should match the following: