create a chmod cron job help please


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting create a chmod cron job help please
# 1  
Old 04-19-2008
create a chmod cron job help please

hi all,

I'm so embarrasingly new; apologies.

So here's my dilemma; files are being uploaded to the server via a php script... this is therefore assigning ownership to 'nobody' rather than the account 'user'.
It's screwing with the permissions and then the owner can't ftp download images that were uploaded through this script.

So what I'm trying to do is create a cron job which will at 2am run through like 4 different folders within the user's account and chmod all of the images within the folder to 644.

Here's an example of what I was told to do:

You will want to use the following commands:

From secure shell as root, run the command:
crontab -e

Then setup a cron job to run hourly with the command 'chown -R $user:$group /home/$user/public_html/$directory' with the correct values for those variables.

- end of example

My question is this... am I going to have to create a cron job for each of the four folders?

Also; in the example the guy said to have the - correct values for those variables...
So, what do I need to change in the command -
'chown -R $user:$group /home/$user/public_html/$directory'

anything with a $ ?

and if it is anything with a $ - what is the group?


thanks in advance for any assistance!
# 2  
Old 04-19-2008
this might help you
# 3  
Old 04-19-2008
Even if the owner is nobody, could you modify the PHP script to create the files world-readable? Then the owner (and anybody else who knows the path) can download them.

You can create four different crontab entries, or a single one pointing to an external file containing a moderately more complex script which loops over those directories. This is probably the more sustainable solution, as you can test it whenever you like, rather than wait for cron to kick in, or muck with the cron timing entries temporarily when you want to test.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

2. UNIX for Dummies Questions & Answers

Create cron job without root

Hi there, I need to create a crone job to backup certain files on my disk without root permissions. Also if I will be able to edit cronetab then I need to know how to edit it with any editor other than vim :mad: (5 Replies)
Discussion started by: aelhosiny
5 Replies

3. UNIX for Dummies Questions & Answers

Need help to create cron job

Dear Experts, I want to create cronjob with the following steps: 1. go to directory /home/logs/ $cd /home/logs/ 2. copy to /tmp/ the most recent file with "prefix" local_data_ and sufix ".gz" ls -ltr drwxr-xr- 4096 Nov 24 2009 bak drwxr-xr-x 24096 Aug... (6 Replies)
Discussion started by: maxsub
6 Replies

4. Shell Programming and Scripting

How to create a cron job to take an uploaded filename and move it?

OK, So complete newbie here. I would normally do this in PHP or through my FTP program script but I can't in this case (the files are not coming from me, coming from a third party FTP upload). I have an FTP server (Linux) accepting files coming in from a standard FTP program. Each file... (2 Replies)
Discussion started by: bull_frog
2 Replies

5. Shell Programming and Scripting

Who can help me with a specific chmod cron job?

Hi, I put a blog on the web for a school project where pupils can post but one thing is not working properly: Photos are not being displayed because the rights of newly uploaded files are always automatically set to 600 by the server (the folder rights are set to 775). So I wrote the following... (4 Replies)
Discussion started by: Peter264
4 Replies

6. Shell Programming and Scripting

Im trying to create a FTP Cron Job

Hello, Im fairly new to this and am hoping for your help in moving forward. 1. I need to carry out a FTP transfer from SERVER1 to SERVER2 at 3am every morning. 2. The FTP is to work on SERVER1 3. There will be many files to transfer (96 files per day) 4. I want to delete the files... (3 Replies)
Discussion started by: nozerf
3 Replies

7. Shell Programming and Scripting

Re : How to create this cron job?

Hello All, Hope this finds you well. I am creating this shell script that will create cron jobs in crontab file. What I am provided with is the start time , intervals and # of trials. Based of Start time ( say 7:15 am ) and interval being 15 minutes, # of trial being 5 , I should create cron... (5 Replies)
Discussion started by: samshaw
5 Replies

8. Solaris

cron job starts new cron proccess

I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies

9. HP-UX

How to create a cron job and run in quality system

Hi Experts, I'm a SAP Basis, I have a small doubt would request you please help on this... 1. I wold like to copy files from one system to another system? as per my knowledge "we have to mount the prod filesystem on the quality box and do a copy every day thru crontab script, or do it via... (2 Replies)
Discussion started by: mahantysk
2 Replies

10. Shell Programming and Scripting

How to create cron job automatically?

How do I write a perl script to get the cron jobs? I could do a perl -e ' system "crontab -l > jobs.txt " '; Is there a better way? Then I can use perl to make changes to jobs.txt. How can I submit the changes. I suppose I could use system "crontab jobs.txt", is there a better way? ... (0 Replies)
Discussion started by: siegfried
0 Replies
Login or Register to Ask a Question