Current time: 11-28-2024, 01:14 AM Hello There, Guest! (LoginRegister)


Post Reply 
[HowTo] Cron for customers
Author Message
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #7
RE: [HowTo] Cron for customers
I am using a modified version of this cron, since I allow only my users to use php scripts, I scan their /var/www/virtual/domain.com/cron/daily/ and run whatever php script they have in there with their own permissions.
So far I haven't had the need to allow them to change crontab frequency.

Quote:#!/bin/bash

CRON_BASE_DIR=/var/www/virtual/
CRON_BASE_PERM=/var/www/virtual/
MODE=daily

if [ "$1" == "exec" ]; then
if [ ! -f "$2" ]; then
exit 1
fi

owner="$( echo $2 | sed "s^\($CRON_BASE_PERM[^/]\+\).*^\1^g" )"
owner="$( stat -c %U "$owner" )"
base="$( dirname $2 )"
cwd="$( pwd )"
cd "$base"
sudo -u $owner "php" "$2"
cd "$cwd"
exit 0
fi

find "$CRON_BASE_DIR" -regex ".*\/\(cron/$MODE\)\/.*" -type f -perm /0111 -exec $0 exec '{}' \;
07-09-2009 09:05 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
[HowTo] Cron for customers - Blondak - 10-08-2008, 02:10 AM
RE: Cron for customers - BeNe - 10-08-2008, 03:20 AM
RE: Cron for customers - FeG - 10-11-2008, 06:24 AM
RE: [HowTo] Cron for customers - mishas - 07-07-2009, 10:08 PM
RE: [HowTo] Cron for customers - BeNe - 07-08-2009, 02:34 AM
RE: [HowTo] Cron for customers - aseques - 07-09-2009 09:05 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)