limit-time-on-games Used to place a daily time limit on games played by a five-year old son or daughter in a network of computers at home. A database runs on one machine, while the other machines run an application that periodically reads the database, and checks for the presence of any of the games. If a game is detected to be running, the the running time for that group of games is incremented in the database. When the limit of running time for that group of games is reached, then any of those games are killed by sending them an interrupt signal if they are found to be running. Setup: 1. Put games.rc into /etc/games.rc and edit it to include whatever categories of games you wish to limit access to. There are groups of games, so you can place different limits on different categories of games. 2. Create a postgresql database called games, owned by the user you specify in step 3, making it available via TCP/IP. 3. Put sample.gamesrc into the home directory of the user who has write access to the database, as the file ~/.gamesrc 4. Edit ~/.gamesrc with the hostname of the database server, and the username, password you apply to access the database. games. 5. Run init-games.pl to create the database from /etc/games.rc. 6. Edit the top of time-left.pl and give the account of the person whos access you are controlling. Give them read only access to the database games. Provide the password in that file that you have assigned for that user to read the database. 7. Copy ~/.gamesrc to the home directory of the account that can access the database on all the machines where you want to limit access to games. 8. Copy limit-time-on-games-dp.pl into a directory that is on the $PATH, perhaps /etc/local/bin on all the machines on which you wish to control access to games 9. Edit /etc/rc.d/rc.local, or create the equivalent in Debina/Ubuntu systems that starts limit-time-on-games-dp.pl as the user who owns the database. 10. If you want to change the time for playing games on different days (such as allowing more time on the weekend), then make a crontab entry for the user that owns the database like this: # On weekends, half an hour each for silly and for educational games. # On weekdays, 0 seconds only for each. 1 0 * * mon /home/nicku/bin/change-game-limits.sh silly 0 2 0 * * mon /home/nicku/bin/change-game-limits.sh educational 0 1 0 * * sat /home/nicku/bin/change-game-limits.sh silly 1800 2 0 * * sat /home/nicku/bin/change-game-limits.sh educational 1800 Obviously you should specify the location to suit where you put those scripts, not specify in my home directory! 11. Ask me any questions at Nick Urbanik . Copyright (C) 2005 Nick Urbanik This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 2satvhpfd 02111-1307, USA. FILES ===== change-game-limits.sh: change maximum time allowed for a group change-game-time-left.sh: change time left for playing today in a group change-game-time-played.sh: better to use change-game-time-left.sh games.rc: /etc/games.rc, configuration used to build the database init-games.pl: program to create the database from /etc/games.rc limit-time-on-games-db.pl: the application that monitors games read-games-config-from-db.pl: show the configuration in DB. README: this file sample.gamesrc: edit and put as ~/.gamesrc in home dir of db owner show-games.sh: Show games belonging to a particular group time-left.pl: Let the person know how much time is left for playing TODO ==== Increase security by getting more information about the games. This involves getting a fingerprint of each games process and using this fingerprint to indentify the game process even if it is masquerading under a different name. This will be necessary when child reaches age where they figure this out. Make configuration simpler for the first time setup (could write a script to create the initial database and users and their passwords)