Linux Crontab

Environment

Linux

Situation

When crontab trigger a job, java command not found occurs.

Reason

The command is not in the PATH variable.

Solution

Add PATH variable to crontab

crontab -e

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/java/jdk1.7.0_76/bin:...

* * * * * [full path]/[script].sh > /dev/null 2>&1

Reference

http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s