Cron changing folder for scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cron changing folder for scripts
# 1  
Old 02-11-2010
Cron changing folder for scripts

I would like to ask if cron when running a planned script changes the current folder for the script.

Thank you!
# 2  
Old 02-11-2010
Tools Very vague question

A cron job is simply a scheduled task. The task could be a commerical (pre-built) program, or a .sh shell script that you have written. Thus, while the following is not necessarily 'good' coding (since errors are not handled), you could create a file myfiles.sh
Code:
cd /home/users/me
ls -l >myfiles.txt

Then, schedule a cron execution for the script myfiles.sh

Or, are you trying to ask a different question?
# 3  
Old 02-15-2010
Yes, thank you.

I just think it would be better if the cron would change the path for every script according to its location (and therefore the line cd /home/users/me wouldn't be necessarry). It's rather a question of architecture of cron than searching for any particular solution.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

changing cron using bash script

How can I change the cron entries only for ABC and XYZ from dosomething_1.0.sh to nowchanged_2.0 using a bash script ? Any help will be appreciated. # # ABC 00,05,10,15,20,25,30,35,40,45,50,55 * * * * /mydir/dosomething_1.0.sh 1>/dev/null 2>&1 # # ## # DEF... (4 Replies)
Discussion started by: jville
4 Replies

2. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

3. Shell Programming and Scripting

Running 2 scripts one after the other using cron

I would like to run two scripts using cron one immediately after the other. Is it enough to put them one after another in the cron file to run at the same time, or will this cause them to run concurrently? (4 Replies)
Discussion started by: 3210
4 Replies

4. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

5. UNIX for Dummies Questions & Answers

changing scripts in /etc/rc2.d

This is a newbie question in which I feel almost ashamed in asking lol. I am told to make changes to /etc/rc2.d so that only certain scripts run. If I change something like S05netconfig to s05netconfig will it still run? What is the difference between S and s scripts (I see both types in there).... (1 Reply)
Discussion started by: rkruck
1 Replies

6. Solaris

how to recreate scripts under /etc/rc3.d folder

Hi All, We have the JMS Queue startup script S52imq and some other scripts in our solaris server 5.8 version. now unknowingly something happend to those scripts and its lost. How can I recreate those scripts again to start the JMQ queue again? We have Solaris 5.10 version which is having... (3 Replies)
Discussion started by: nsurendiran
3 Replies

7. UNIX for Dummies Questions & Answers

Scripts and changing users

Hi, I am writing somescripts to shut down some services in Korn Shell. Some of the services are under different owners. For example when I want to shutdown NXserver I need to be "root", but when I shut down the webserver I need to be under a different user. Manual I would use "su root" and... (1 Reply)
Discussion started by: bonekrusher
1 Replies

8. UNIX for Dummies Questions & Answers

cron job from specific folder

i'd like to be able to run a cron job from a specific folder /var/www/html a php script which imports rss feeds i created a simple shell script cd /var/www/html php -q import.php webmin says it executed correctly, but when i check the site, nothing has happened what am i doing... (1 Reply)
Discussion started by: sanchoquixote
1 Replies

9. Shell Programming and Scripting

help in cron scripts

Hi, i have scheduled my scripts in cron, some time the script doesn't runs ..which will impact me a lot, can some one help me such that mail has to come stating script has run successfully/unsuccessful any help will be appreciated.. thanks in advance, geeko (0 Replies)
Discussion started by: geeko
0 Replies

10. UNIX for Dummies Questions & Answers

changing permission using scripts

I have been trying to create a script that changes the user rights to read in the 'other' group across directories. The problem I'm having is that when i execute the script, the permissions of the directories remains the same. HELP (8 Replies)
Discussion started by: BigTool4u2
8 Replies
Login or Register to Ask a Question