jsession is a tiny session manager for X, written in Bash and C. On login, It searches through a configurable list of files and runs the commands in them (blacklisting and commenting is supported too).
Follow the instructions in the included README (including installing the dependencies), and note how configuration works. Make sure you have a window manager being launched (put a call in one of the 'init' files listed in the config file) before trying to get a session going! It's also probably a good idea to have a terminal emulator run so you can quit the session using
(Of course, you could always start X from a terminal (tty) and log out by sending it an interrupt signal.)
To get jsession to run on login, put a call to jsession in your ~/.xinitrc file, or look up how your distribution/display manager do things. If you're not using systemd and you get some permissions errors with stuff, try installing ConsoleKit and replacing the line with
ck-launch-session jsession [args...]
As noted in the documentation, if you're not using systemd, you'll have to have the daemon running as root to be able to shut down/reboot/suspend without root privileges. You can just have it run from an init script somewhere, but it's always nicer to have it handled through the distribution's normal daemon-handling mechanism. A systemd service file is in the download section (and this is in the Arch Linux package too).