LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 08-03-2015, 10:04 AM   #1
suguprathap
LQ Newbie
 
Registered: Aug 2015
Posts: 4

Rep: Reputation: Disabled
How to change cronjob default environment


Hi,

root@Testing@centos~#crontab -l
* * * * * env>/tmp/cronenv

root@Testing@centos~#cat /tmp/cronenv
SHELL=/bin/sh
USER=root
PATH=/usr/bin:/bin
PWD=/root
SHLVL=1
HOME=/root
LOGNAME=root
_=/usr/bin/env


I want to change the PATH ENV to /bin:/usr/bin instead of /usr/bin:/bin. Please someone tell me how to change it commonly for all the users.
 
Old 08-03-2015, 11:13 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
I think you should not do that, but use full path in your cronjobs. Alternatively you can write scripts to be executed by cron and you can specify PATH as you wish within those scripts.
 
Old 08-03-2015, 01:52 PM   #3
suguprathap
LQ Newbie
 
Registered: Aug 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
I agree with you that we can specify PATH in cronjob itself. I just want to change the default one and that's what fulfil my requirement.
 
Old 08-03-2015, 04:04 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,734

Rep: Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920
Interesting question and one that I have not considered. It appears the default path is configured in the daemon itself. I can not find any default configuration file where it is set.

Hopefully you do not have a multiple files/applications that have the same name in your path environment.
 
Old 08-04-2015, 01:55 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
http://lists.freebsd.org/pipermail/f...ry/113601.html
 
Old 08-05-2015, 06:00 AM   #6
suguprathap
LQ Newbie
 
Registered: Aug 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Any pam related configuration will help me to get this done ?
 
Old 08-05-2015, 06:39 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Did you check the link I gave?
looks like the PATH setting is hardcoded, therefore you should download the source and modify it (although I do not recommend it at all).
 
  


Reply



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
How to change default desktop environment on Ubuntu? QueenZ Linux - Newbie 7 07-17-2010 11:54 AM
Change rsyn cronjob via PHP Script ? utw-mephisto Linux - General 1 04-13-2010 07:46 AM
change grub boot order, all instructions say change default, but I don't see default mhg Linux - Newbie 5 11-09-2008 10:01 AM
set cronjob environment donhare Linux - Software 0 01-31-2005 06:51 AM
How to change default desktop environment???? thegreenearth Linux - Newbie 7 11-15-2001 02:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:57 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
Open Source Consulting | Domain Registration