LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 12-06-2005, 12:20 PM   #1
lolson33
LQ Newbie
 
Registered: Dec 2005
Posts: 1

Rep: Reputation: 0
How do I set my profile in CRON job?


I am trying to setup my cron job to run sqlplus command but I kept get sqlplus command not found.
I think it didn't use the correct profile. How do use my profile when I am running cron job.

Thank you,
 
Old 12-06-2005, 12:50 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

The users profile is never parsed when running a script from cron.

The easiest way (my opinion) to solve this: Put a snippet of code in the beginning of the script that is called.

Code:
# Needed for crontab, profile user not automatically parsed.
[[ "`/usr/bin/tty`" == "not a tty" ]] && . ~/.profile
The tty command tells which tty is connected, if none is (which is the case when running from cron) it will output the 'not a tty' message.

The above line will parse .profile when 'not a tty' is encountered.

Hope this helps.
 
Old 12-06-2005, 05:18 PM   #3
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 51
Just put the full path to the sqlplus command in the cron job. Eg.
Code:
/usr/sbin/sqlplus
You can find out the path to it by running
Code:
which sqlplus
when logged in as yourself.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CRON Job tommytomato Fedora 12 09-13-2004 01:38 AM
cron job working2hard Programming 6 07-28-2004 10:12 PM
cron job ? johnyy Linux - Software 3 12-10-2003 07:00 PM
how to set cron job to run every 5 mins? gsbarry Linux - General 7 05-28-2003 01:30 PM
cron job? luap Linux - Software 2 03-16-2003 09:48 AM


All times are GMT -5. The time now is 06:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration