Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Crontab and working directory

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-05-2010   -   Original Discussion by manustone
manustone manustone is offline
Registered User
 
Join Date: Jul 2009
Last Activity: 21 March 2012, 9:32 AM EDT
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Crontab and working directory

Hi all
I would like to crontab some python script I have.
These have the task to write a txt file on the same directory where they are let' say 'scriptFolder'.
When I schedule the script execution with crontab the file is printed out somewhere else.
Is there any way to tell crontab that for that script the directory should be the one of the script?
I am using the following

46 8 * * python \scriptFolder\MyScript.py

Can you help me with that?
Sponsored Links
    #2  
Old Unix and Linux 02-05-2010   -   Original Discussion by manustone
agn agn is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 6 August 2013, 7:49 AM EDT
Posts: 345
Thanks: 0
Thanked 21 Times in 21 Posts
Try,

Code:
46 8 * * cd \scriptFolder; python MyScript.py

Sponsored Links
    #3  
Old Unix and Linux 02-05-2010   -   Original Discussion by manustone
manustone manustone is offline
Registered User
 
Join Date: Jul 2009
Last Activity: 21 March 2012, 9:32 AM EDT
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
It works!
Thank you very much!
Regards
Mn
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
crontab not working rajesh_hv UNIX for Advanced & Expert Users 4 10-28-2008 08:45 AM
curl from crontab not working eBay UNIX for Dummies Questions & Answers 1 06-29-2008 02:58 PM
Pro*C Update not working from Crontab alhallay UNIX for Advanced & Expert Users 2 09-16-2007 01:25 AM
crontab NOT working baanprog UNIX for Advanced & Expert Users 2 09-26-2006 01:11 PM
crontab not working right kymberm UNIX for Dummies Questions & Answers 3 07-09-2003 05:21 PM



All times are GMT -4. The time now is 07:03 PM.