How to copy scheduled task in plesk - cron

Plesk version: 11.5.30
I want to copy 4 scheduled tasks from one website to 31 other websites in Plesk.
How can this be done?
I can not find any copy / paste function. If I have to do this by hand it will take somewhile.
Example of a task I want to copy:
Switched on
Min: 10
Hour: 2
DM: *
M: *
DW: *
Command: /usr/bin/wget -O/dev/null -q http://www.mywebsite.nl/emailservice/script.php

Try to use crontabmng utility. All necessary options you can find with
/usr/local/psa/admin/sbin/crontabmng --help
Pay your attention on 'set' option.

Related

How to configure cron to run at multiple random intervals?

I'm working on a new project and I would like to setup a cron to run every 6-8 hours at a random minute. Any suggestions on the best way to achieve this would be greatly appreciated.
Let's run the cron every 6 hours:
0 */6 * * * /path/to/script.sh
Now, in your bash script:
#!/bin/bash
maxdelay=$((2*60)) # 2 hours converted to minutes
delay=$(($RANDOM%maxdelay)) # a random delay
(sleep $((delay*60)); /path/to/script.sh) & # background a subshell to wait, then run the script
You can also use anacron for RANDOM_DELAY feature.

Pimcore scheduling

In Pimcore when I schedule an object to publish, it didn't work. I see that we require to enable cron job in some file. I didn't get complete details on this any where. Is there any step to enable this process?
Can we use scheduling as part of workflow?
Yes, that is correct, you need to add the cron job to crontab as described in step 5 here:
https://www.pimcore.org/docs/latest/Getting_Started/Installation.html
You need either a shell access or a control panel like cPanel or Plesk to set this up. The process is different for each operating system, but for most of the Linux distributions it means executing this command as your server user (for Debian/Ubuntu that is www-data, check what the user is for other distributions):
sudo -u www-data crontab -e
In there you have to add this line (modify the path to your console.php):
*/5 * * * * php /path/to/pimcore/cli/console.php maintenance
As said this is different for every linux distribution, but should be simple enough once you figure out how to setup a cron job.
It worked. I am using AWS instance, followed below steps.
1) pbrun beroot (Power Broker - root privilege)
2) crontab -e
3) insert mode (i)
4) */5 * * * * php /...path../pimcore/cli/console.php maintenance
6) :wq
Can we use scheduling as part of workflow? I have an object, after reviewer reviews, it should get published based on scheduling. Is there any way to schedule in workflow?

how to schedule a cron job to run every second week

I have a cron command which I using currenly for run daily. I want to make it run every second week Monday morning 9AM. please advice
0 0 * * * curl -s -L web.url.com/user/adminNotifier
you can use this site to generate Cron command
http://crontab-generator.org/
hope this helps you

Why my scheduled job is not working?

I define a job with crontab like this
0 2 * * * dbadmin . /home/dbadmin/back.sh
it is not root I want to run this .sh file with dbadmin user.
but when I checked it is not working.
in the log it gives this:
Feb 22 21:16:01 localhost crond[14634]: (*system*) BAD FILE MODE (/etc/crontab)
Feb 22 21:16:01 localhost crond[14634]: (dbadmin) RELOAD (cron/dbadmin)
Feb 22 21:16:01 localhost crond[28451]: (dbadmin) CMD (dbadmin . /home/dbadmin/back.sh)
How can I fix this? thanks in advance
Make a crontab entry as dbadmin without the username in it:
0 2 * * * /home/dbadmin/movefolder.sh > /home/dbadmin/cron.out 2>#1
Each day the logfile /home/dbadmin/cron.out should be replaced by a new one.
When you are confident about the cron+movefolder, replace the outputfile with /dev/null.
When above fails, check calling the script as dbadmin:
sh /home/dbadmin/movefolder.sh
When this one works and cron fails, it might be the environment. Try saomething like
0 2 * * * . /home/dbadmin/.profile; /home/dbadmin/movefolder.sh > /home/dbadmin/cron.out 2>#1
Using the crontab program, you normally have access only to the 5 scheduling fields (minute, hour, day of month, month and day of week). However, with Vixie cron (usually on Linux) by editing the system crontab file (/etc/crontab, as well as files in /etc/cron.d) you can use the 6th field for the username. For example, see How to specify in crontab by what user to run script?
If you use crontab to enter this line
0 2 * * * dbadmin . /home/dbadmin/back.sh
^^^^^^^
the "dbadmin" username is treated as the command to execute. You can (as noted in crontab's manual page) use that line in /etc/crontab. I pointed out that this is Vixie (also known as ISC) crontab. Legacy systems such as Solaris have a less capable crontab which would not allow specifying the user to run under.
According to cron's manual page, it will send output via email. Perhaps there was no email because the command "dbadmin" failed.
You need to use sh command for executing sh file.like following
0 2 * * * dbadmin sh /home/dbadmin/movefolder.sh
Hope it works.
Thank you.

How to set up a Cron job?

I am trying to set up Recurring Invoices as documented on http://www.fusioninvoice.com/support/recurring-invoices but I don't understand and cant work out what to do.
I have found a alphanumeric 'key' but not sure where or what to do?
Do I need to createa file or something?
If curl is available on your system, you can schedule it to ping the URL.
Use crontab -e to edit the cron table and create a new entry. For example, this will ping the URL every day at midnight.
0 0 * * * /usr/bin/curl --silent http://your-server.com/index.php/invoices/cron/recur/your-cron-key-here &>/dev/null

Resources