sh
#!/bin/sh curl http://runonce.herokuapp.com/ Will run only once (and it shows "Hello, world!" if it runs), even if you reinstall the system, and put the script again.
EDIT: I figured I would release a script behind runonce as well. Nothing special, as it wasn't supposed to be released either way, but whatever.
<?php $db = pg_connect("[connection information]"); $ip = isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"]; pg_query("DELETE FROM users WHERE time < now() - interval '1 day'"); $result = pg_query_params($db, "SELECT * FROM users WHERE ip = $1 LIMIT 1", array($ip)); if (!pg_fetch_row($result)) { echo "Hello, world!\n"; pg_query_params($db, "INSERT INTO users (ip) VALUES ($1)", array($ip)); } As well as database schema
CREATE TABLE users ( ip inet PRIMARY KEY, time timestamp with time zone NOT NULL DEFAULT now() ); CREATE INDEX ON users (time); The data is stored in Heroku's database, feel free to check their privacy policy if you like. I don't check the data stored in a database, it's stored purely to allow the code to execute once.