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
Related
I want to have a crontask that executes every minute.
However in plesk you can only set a crontask every hour and the minute to execute it.
You can however choose to do this with a workaround.
From the Plesk manual I found : https://support.plesk.com/hc/en-us/articles/115004281794-How-to-create-a-scheduled-task-to-fetch-URL-every-15-seconds
And they noted the following code :
for i in {1..4}; do curl --silent "http://example.com" &>/dev/null; sleep 15; done
However I am a bit afraid of using this code.
My guess to make a script execute every minute would be like:
for i in {1..4}; do curl --silent "http://example.com/myscript.php" &>/dev/null; sleep 60; done
But what scares me a bit is : /dev/null
I am not a unix guru at all but to my knowing /dev/null is the trashbin.
And what does 1..4 do?
Looks to me like it repeats itself only 4 times?
-Run a command : Fetch a URL
-Url : http://example.com/myscript.php
-Run : Cron Style * * * * *
Your URL will be fetch every minute
I have a cron every two minutes (*/2 * * * *) firing the following command...
wget "http://www.example.com/wp-cron.php?import_key=my_key_stringimport_id=16&action=trigger"
Trouble is, it is emailing me every two minutes, and also creating copious tiny files on the server, one each time.
I have tried several things. I know there is plenty of info out there about suppressing email feedback from cron.
cPanel's Cron page, where my crons are set, makes clear: "If you do not want an email to be sent for an individual cron job, you can redirect the command’s output to /dev/null. For example: mycommand >/dev/null 2>&1"
But when I did it like this...
wget -O "http://www.example.com/wp-cron.php?import_key=my_key_stringimport_id=16&action=trigger" >/dev/null 2>&1
... the cron stopped functioning.
(I believed an -O was necessarily to direct the output).
What is the proper way to formulate this?
To suppress mails from cron you can add before your line in cron MAILTO
MAILTO=""
*/2 * * * * command
This seems to do the trick...
wget --quiet -O "http://www.example.com/wp-cron.php?import_key=my_key_stringimport_id=16&action=trigger"
Ie. Add --quiet
Answer found elsewhere on Stackoverflow.
Bit confused how --quiet and -O co-exist.
I want to know if there is any way to auto-commit changes made in git based on specific time.
Suppose if I set the configuration, it should commit whatever the code present in repository at exactly 12:00 AM every day or at specific time in a day.
From what I found after searching, there is a way to commit on every time we save a file. But not timely auto-commits.
As Nic5300 suggested, an easy way to do this is to write a simple script that is called by cron at a specific time:
auto_commit.sh
=======================================
#!/bin/bash
MESSAGE="Auto-commit: $(date)"
REPO_PATH="/home/user/repo"
git -C "$REPO_PATH" add -A
git -C "$REPO_PATH" commit -m "$MESSAGE"
Just update the REPO_PATH and MESSAGE with whatever you'd like. Now, you add the script to your crontab by running crontab -e.
To run it every night at midnight, your crontab would look like this:
* 0 * * * auto_commit.sh > /dev/null 2>&1
Obviously, you'd have to update that path to wherever your script is saved. Just make sure you have cron running (depends on what init system you're using), and you should be good to go. Check out https://crontab-generator.org if you want to fiddle more with your crontab.
Your crontab example would start executing the auto_commit.sh script at midnight every minute for 1 hour. To make it run only once every midnight, you need:
0 0 * * * auto_commit.sh > /dev/null 2>&1
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
I am new to cron jobs and have set up one in Plesk to execute every minute however I am not sure if the command is correct due to it not working.
curl http://www.yourdomain.com/twitter_cron.php
I am running on a Centos VPS - the problem is I am not sure if I need a specific root to curl.
sgeorge-mn:~ sgeorge$ which curl
/usr/bin/curl
You need to use full path in cron for curl; otherwise you need to have proper PATH variable specified in crontab
So for example:
* * * * * /usr/bin/curl http://www.yourdomain.com/twitter_cron.php