Based on existing Dead Man's Scripts long lost.
Requires PHP with an Apache server capable of using cron jobs and email. No special databases are required.
- SDMS uses a simple counter that increments by 1 with each CronJob action.
- Every X days SDMS sends a "check-in" e-mail to a specified e-mail address.
- The email has a link which resets a counter.
- When clicked, the counter resets to 0.
- Once X number of days have passed without a check-in the system begins sending DMS messages to designated recipients.
- E-mails are in plain text format.
Unzip the distribution archive to a folder on an Apache web server and run the initialize.sh
. Ensure the data/
subdirectory exists with the appropriate 755 permissions.
Or paste this in your SSH session:
echo 0 > daynum.dat;echo 0 > token.dat;chmod +w daynum.dat;chmod +w token.dat;[ -d data ] || mkdir data;echo order deny,allow > data/.htaccess;echo deny from all >> data/.htaccess;
Variables must be configured in the globals.php
file.
baseFolder
: The full path to the installation directory.dataFile
: The full path and filename of thedaynum.dat
file.footerFile
: The full path and filename of thefooter.txt
file.tokenFile
: The full path and filename of thetoken.dat
file.checkInterval
: The interval at which check-in e-mails should be sent. Most users will want to set this at around 5 to 7 days.sendAfter
: The number of days to wait for check-in before releasing messages to recipients. Can be anything greater than - -checkInterval
, but ideally should be 3 to 4 times thecheckInterval
value to avoid unintentional misfires.webPath
: The full web address that corresponds to the location where PHP-DMS is installed.ownerMail
: The e-mail address to which check-in messages should go.mailFrom
: TheFrom:
address for all PHP-DMS e-mails.subjectPrefix
: The prefix for theSubject:
line of all messages.
Sadly messages are organized as folders. (This is a shitty way to do things.)
The folder structure is / recipient e-mail address / sending after day / message file
The sending after day is the number of days after the sendAfter value in globals.php
.
A file called `data/[email protected]/0/message` will be sent to [email protected] on the `sendAfter` date.
A file called `data/[email protected]/7/message` will be sent to [email protected] 7 days after the `sendAfter` date.
Each folder can contain an unlimited number of plain text message files. The file name will be used as the e-mail subject line. It is not necessary to include a .txt extension.
Numbered folders should be entirely numeric without no special characters, no letters. Leading zeroes are okay. The DMS looks at the base 10 integer value equivalent of the folder name.
The script should be called from cron. A possible crontab entry would be:
@daily /usr/bin/php -f $HOME/path/to/sdms/run.php
There is an htaccess
file in to restrict remote access to the directory. Rename the file for Apache installation to .htaccess
.
If you want secure the DATA folder and checkin.php
file using .htaccess
restrictions:
/usr/bin/htpasswd -c .htpasswd username