LinuxQuestions.org
Help answer threads with 0 replies.
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-21-2007, 11:56 AM   #1
va1damar
LQ Newbie
 
Registered: Oct 2006
Posts: 17

Rep: Reputation: 0
exec(), crontab and web permissions


So how about this idea?

I'm using PHPList to send newsletters and have to uncomment the cronjob when I'm ready have a new one processed. So I wrote a function that gets a copy of the current crontab.

Code:
exec("crontab -l", $crontab);
Then it searches for the PHPList cronjob, and checks to see if it's commented out. The program edits the copy of the crontab (commenting the cronjob if it's uncommented, or vice versa), and then saves the copy to a temp file and adds that as the new crontab.

Code:
exec('crontab '.$temp_file);
Works fine when I run it from the commandline as my personal user, but when I try to run it from the web page, it fails. When I run it from a web page, it's running under the 'apache' user, right? So maybe that user doesn't have permission to run crontab? Or maybe it's trying to get the crontab for 'apache' instead of my user?

And how safe is it to be running this kind of thing on the web anyway? The only link to this program would be from within PHPList which does some user authentication. And I don't use any user data in the exec() function. So I'm fine.. right?
 
Old 02-21-2007, 04:55 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Why not look at http://docs.phplist.com/CronJobExamples first?
 
  


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
Backup Exec Permissions issues greencabby Linux - Enterprise 1 02-13-2007 02:46 PM
crontab & process permissions JJX Linux - General 6 05-06-2006 11:26 AM
exec cmd=perl... work but exec cgi doenst crions Slackware 5 12-09-2005 12:17 PM
Web server permissions zmarty Red Hat 5 10-31-2003 11:26 PM
I'm confused - Crontab and Access Permissions Newman_SCO Linux - Newbie 5 09-03-2003 08:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:10 AM.

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
Open Source Consulting | Domain Registration