Wednesday, March 19, 2008

How to reset a user on the same day of the month his account was created

To accomplish this, you'll need to remove the following line from the /etc/cron.d/directadmin_cron:

40 1 1 * * root echo "action=reset&value=all" >> /usr/local/directadmin/data/task.queue

Now to get a user to be reset, you'll have to tell the system to do it via a cron job which has to be created. To do this, we'll use the custom creation scripts to do the work.

contents of /usr/local/directadmin/scripts/custom/user_create_post.sh:

#!/bin/sh
echo "`date +"0 %H %e * *"` root echo 'action=reset&value=${username}&type=user' >> /usr/local/directadmin/data/task.queue" > /etc/cron.d/${username};
chmod 755 /etc/cron.d/${username}
killall -HUP crond
exit 0;


contents of /usr/local/directadmin/scripts/custom/user_destroy_post.sh:

#!/bin/sh
rm -f /etc/cron.d/${username}
exit 0;

No comments: