Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-05-2009, 04:12 PM   #1
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Rep: Reputation: 33
"chroot"ing a script


how could we run a script from a certain directory?

Its a cron job need to be run by userA

What was done

15 * * * *      userA /etc/cron.daily/
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?
Old 02-05-2009, 04:45 PM   #2
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,865

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
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.

command one
command two
Steve Stites


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 02:03 AM
Symlinks working from "inside" 'chroot' to "outside" ? amn Linux - Newbie 2 12-07-2007 02:09 AM
Problem when "Make"ing moodin splash engine [DK]LaMa Linux - Software 0 03-20-2006 03:15 PM
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 05:51 AM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 03:32 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:03 AM.

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