Trying to start a cron job on serversfree - cron

I'm trying to add a cron job on my server, that is hosting here http://partisscan.bugs3.com/.
The provider for that is serversfree http://www.serversfree.com.
It is realy good but i can't make a cron job. I want my php file http://partisscan.bugs3.com/scan.php to be started every minute(maybe latter less often but for start). So i added a cron job in a cron job manager under control panel but it's not working.
my cron job is:
1 * * * * php -f /home/u798416153/scan.php
However it's not working:S
any ideas?

There are many possible reasons for not working.
Regarding the file:
Executing permissions of the file.
Owner of the file.
Regarding the crontab:
To which user does this crontab correspond the line you posted?
Does it have to be executed by root or any other user? If it is not root, you have to make sure that the user is not in /etc/cron.d/deny.

Related

Using Omnilight Yii2 Scheduling

I have installed this extension to assist me in my cron jobs omnilight/yii2-scheduling. The extension has good documentation that is why I settled on it amidst all the other cron-jobs extensions available for yii2. However, I am stack at some place that I need assistance. There is a place where I am asked to put a single line of code on the crontab:
* * * * * php /path/to/yii yii schedule/run --scheduleFile=#console/config/schedule.php 1>> /dev/null 2>&1
However, I am not sure where to place it, i.e. where is the crontab in yii2? anyone who has used this extension and is able to get it running to assist me here.
Maybe a little later but you must put that in the crontab, a cron is :
cron is a Unix, solaris, Linux utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon
and the crontab is where are stored all this crons. To edit this file you must use in terminal:
crontab -e
Put that line here. Save and you are ready to go.

VtigerCRM 7.0, scheduler don't work

Hello to everyone and thank you in advance,
I am in a company that has started using the vtigerCRM 7.0 open source on Linux and as we worked out the creation of the workflows to send emails and so on we set the scheduler to run crons for the workflows every 15 minutes, but it never runs. Is there anything we can do to make the scheduler work?
Kind Regards,
Dimitris
First step is to check cron setup.
Using crontab -e you will find the details of cron job.
You should define the cron as below:
* * * * * {Full path of vtiger directory/cron/vtigercron.sh >/dev/null 2>&1
Once you define the workflow you can test the workflow by calling cron file directly as below:
http://{crm url}/vtigercron.php
Make sure than you have set the 775 permission to cron folders and their files.
Hope this will help you.

Cron Jobs Not working- Sugar CRM

I have set up cron jobs for my SugarCRM as requested by Sugar:
But when we look at last runs it does not seem to work or show anything.
I am using this for email reminders, mail check and also scheduled campaign run.
Is command-line php on your system installed and the executable in whatever PATH that cronjob is using?
If not make sure to specify the full path, e.g. /usr/bin/php or /usr/local/bin/php are common.
Also based on your operating system/distribution the php command line executable may have a different name, e.g. php5.
Make sure to use the web-process user's crontab or execute php with sudo -u webprocessusername, so that the cronjob will be executed with the correct permissions.Running the cronjob as different user or even root is usually not a good idea.
To see potential error messages replace > /dev/null e.g. with > /tmp/sugarcron.log or > /path/to/webfolder/sugarcron.txt and check the file after a minute.
Further info on the SugarCRM Knowledge Base:
Introduction to Cron Jobs
Troubleshooting Cron and Schedulers

Cron job that saves file

Is it possible to run a cron job on host that also saves a file to your website directory? I have an API I download a xml file from hourly. I would like to schedule cron to automate this but I'm not sure if it's possible.
You can write a cron job to execute an arbitrary script. The script can do whatever you like provided it has the appropriate permissions.
* * * * * /bin/execute/this/script.sh
Will run the script script.sh
You need to configure the crontab entry appropriately (obviously).
Yes. You can schedule a script in cron.
In the script you can add lines to generate the file and to place the file in the location you want.
Note: Be sure that you have permissions to create a file in that specific location path.

Where to locate Centos 6 cron job .sh file

I am really new to Linux and I apologize if this is rudimentary, but I have Google'd to find examples with no clarity and I am confused. (the question relates to a server running CentOs 6)
My questions are:
I am not sure what is the default directory that I should store a .sh file in so that a cron job can run it.
Is the syntax and sequence of my code in .sh file below correct?.
I have tested the TSQL and its fine.
#! SQL="DELETE FROM messages WHERE date < DATE_SUB(CURDATE(), INTERVAL 7 DAY)"
MYSQL_USER="root"
MYSQL_PASS="xxxxxx"
MYSQL_DB="mydb"
I understand that the cron should contain this to do it on a daily basis:
0 0 * * *
But I am just having some apprehension of how to put it all together so I don't screw things up. A full example or explanation or a reference link would be greatly appreciated.
I believe that cron will execute the script from whichever directory it is in, given that:
the file has execution permission for the user that cron runs as (usually root if job is configured in the system-wide crontab)
the cron line specifies the full path to the script
So, if your script is /opt/script.sh, specifying this in cron:
0 0 * * * /opt/script.sh
will execute script.sh each day in 12:00am.
Please note that if this is the system-wide crontab (/etc/crontab) it should also include a username as which to execute the command:
0 0 * * * username /opt/script.sh
Also, something to make sure when working with cron is to either use full paths when calling external commands from the script or to set up the PATH variable (either in the script itself or on the crontab file). This is needed because usually the environment in which cron jobs are run is pretty restricted.
Another thing to have in mind is that if any output is generated by a cron job this output is sent via mail to the user executing the cron. So to have some feedback from the script you have to either set up the system so that the mail message ends up in a mailbox which is read by a human being or the script sends all of it's output to a log file or syslog.

Resources