LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "chroot"ing a script (http://www.linuxquestions.org/questions/linux-newbie-8/chroot-ing-a-script-702566/)

knockout_artist 02-05-2009 03:12 PM

"chroot"ing a script
 
Hi,

how could we run a script from a certain directory?


Its a cron job need to be run by userA

What was done

crontab:
Code:

15 * * * *      userA /etc/cron.daily/script.sh
scrpt.sh:
Code:

cd /desired-dir
command one
command two


issue is it does cd and then run rest of the commands from root(I assume)

Any Ideas?

jailbait 02-05-2009 03:45 PM

If you mean that you want to run command one and command two from /desired-dir then the cd command is not what you want. Linux does not look for commands in the current directory. Linux looks for commands in the PATH and if the current directory is not on the PATH then those commands will not be found. Change the PATH instead of changing the current directory.

Code:

PATH=$PATH:/desired-dir
command one
command two

-------------------------
Steve Stites


All times are GMT -5. The time now is 07:27 AM.