LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



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

Rep: Reputation: 33
"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?
 
Old 02-05-2009, 04:45 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,593

Rep: Reputation: 188Reputation: 188
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
 
  


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 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 6 03-21-2013 11:35 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


All times are GMT -5. The time now is 11:13 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