How to schedule sqoop job using crontab - hadoop

I have created sqoop job which is working perfectly but when I am trying to schedule it using crontab it is not working.I have scheduled it as follows,
50 12 * * * sqoop job --exec myjob_direct_append >> /home/training/my_Local/direct_append1.log
Please Guide the correct way to do it.

This looks fine to me. Where are you executing this from? Is it a system crontab (usually /etc/crontab) ?
Try scheduling:
* * * * * sqoop job --exec myjob_direct_append >> /home/training/my_Local/direct_append1.log 2>&1
This would run every minute and log any error message to the direct_append1.log so you can debug the issue quickly.

Related

El Capitan: CRON Job is unable to trigger a shell script

*/10 * * * * /bin/sh /dataScience/dat/JOB/forker.sh
Above is the cron job which does not execute. I have checked separately both the functioning of cron job and shell script which works fine. Even the below command works well.
/bin/sh /dataScience/dat/JOB/forker.sh
I have also checked the permissions of forker.sh which shows
-rwxr-xr-x 1 mango wheel 442 Nov 20 12:53 forker.sh
Am i missing something which restricts the cron job from triggering the script?
Generally the syntax for the job goes like:
minute hour dom month dow user cmd
In your case, the job might be for multiple user, it seems
*/10 * * * * /bin/sh /dataScience/dat/JOB/forker.sh
Which implies it should be run at the interval of 10 mins all the time. Which is not problematic.
Can you tell us if the following is giving you the output at all?
*/10 * * * * (echo "Printing."; echo "Logging." > /dataScience/dat/JOB/abc.txt | mail -s "Mailing" your_email)
Note: I wanted to comment this, since this is not exactly the answer but debugging, but I have reputation lesser than 50, hence couldn't comment.

Execute external php script as cron in laravel 5 job scheduler

I am trying to execute an external php script using laravel job scheduler. The script works fine when executed using cron tab, However, when I try to run this via scheduler using the command below
$schedule->exec("/home/script.php")->cron('* * * * * *');
It does not perform any operation. Is there anything which I am missing ?
you need to add the following Cron entry to your server
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

Cron doesn't work in Magento1.7

I use Magento for my shopping, and I want to give all logged-in users have 3% discount for all products, so I wrote a rule, but it only worked for two days and after two days I had to re-apply it again, my Cron setting in Magento admin is:
Generate Schedules Every: 60
Schedule Ahead for:10
Missed if Not Run Within:60
History Cleanup Every:120
Success History Lifetime:120
Failure History Lifetime:120
To solve this problem, I wrote a Cron job in DirectAdmin panel to call cron.sh file in root of Magento (cron.sh is a shell script file that call cron.php), but it did not work properly, please guide me to solve this problem.
Cron job setting in Directadmin panel is:
0 0 * * * /usr/local/bin/php /home/noorantel/domains/nooran.com/public_html/shopping/cron.sh >> /home/noorantel/domains/nooran.com/public_html/shopping/var/logfile.txt
So firstly the Magento cron should run with the following regularity.
*/5 * * * *
This will mean that it will run every 5 mins.
Secondly you seem to mix up what type the file is either you need to run the php version or the bash version but what you seem to be doing is trying to run the bash version with php. Try the following.
*/5 * * * * /bin/sh /absolute/path/to/magento/cron.sh
Or
*/5 * * * * /usr/local/bin/php /absolute/path/to/magento/cron.php

CRON JOB is not running script

I'm trying to schedule a cron job here is my command:
*/5 * * * * USER -q /path/cron.php -mdefault 1
I'm trying to run this magento script every 5 minutes. I see the command being run when I open the cron log via grep CRON /var/log/syslog.
unfortunately the script never executes. I would appreciate any help.
Edit the crontab of the user you want to assign the job to:
sudo -u USER crontab -e
then in the crontab you can schedule the cron.php job in the following way:
*/5 * * * * php /path/to/cron.php

Status of cron job

I have written a cron job as follows:
$crontab -e
Then it opened a file where i wrote
5 * * * * USERNAME PATH-TO-SHELLSCRIPT
How would i come to know that my job has been executed?
Do something with the script? Edit a file and add timestamp for example to see if its ok :)
You can use a log file. Create a file under your home directory, e.g., "/home/user/.cronlog/script1", and output script execution time and status messages with timestamps. You can then check the logs to see script history. To test your script first execute it every minute. Then change the crontab entry to the actual period.
Also make sure you understand the time parameters so you know when to expect it to work :)
I use crontab for a 5 min interval cron like this: */5 * * * *
http://en.wikipedia.org/wiki/Cron

Resources