Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On my old server, I would create a sub domain and set a cron task up for a file on that sub domain. The cron created a text file it used as a lock file to make sure it didn't run 2 at the same time (the cron checks if its running every 5 mins). This was working great.

Now I have moved to the new server, I create my subdomain and set up the cron task BUT the script doesn't have permission to create the text file now. All I want is for that text file to be created successfully without having to give write access specifically like it used to but I can't see what the problem is.

I am running CentOS with Plesk. I was running CPanel (should have kept it :( )

The error I get now is Access denied for user 'apache'@'localhost' (using password: NO)

Can someone help me understand what I need to do.

share|improve this question
    
Are you sure that's not 2 error messages? The Access denied ... bit looks like a MySQL error message to me. What user/group is the cron job running as? What are the permissions/ownership of the directory that you want to create the lock file in? –  Iain Jun 5 '11 at 16:57
    
To be honest I don't know what user / group the script runs as :( I know on my old server it ran as the domain user but this one seems a little different. How can I check? With regards to the error, sorry, the first part is mine. Will remove for clarity. –  webnoob Jun 5 '11 at 16:59

1 Answer 1

up vote 0 down vote accepted

I got around this by creating one folder with 0777 permissions that I store all my lock files. If someone gains access, no worries.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.