Using cron, you can edit the superuser's crontab with for example
EDITOR=nano sudo crontab -e. When I tried adding a line like
* * * * * say aa, the say command was run even after I logged out to the login window.
Using launchd, save a property list like this as for example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
sudo chown root /Library/LaunchAgents/test.plist and
sudo launchctl load /Library/LaunchAgents/test.plist. The say command scheduled by launchd was also run when I logged out to the login window.