Have programs executed automatically when the tilde server has been rebooted
Ever wanted to make sure programs running on your shell are down as little as possible? Well that's very possible with the help of crontab.
Crontab is a task scheduler which runs tasks called cron jobs.
Creating our cron job
The cron job we're going to add will run a bash script which can be used to auto run multiple commands, plus the in-built shell parsing in crontab is very limited.
Running crontab -e will open up your crontab file in a text editor where you then need to add the following and save:
@reboot bash ~/startup
Now any program you want to have executed automatically should go into ~/startup and ~/startup is executed within a bash environment.
Taking it a step further with tmux
A terminal multiplexer (in this case tmux) or dtach which isn't a terminal multiplexer can be used to keep programs open while providing access to their interface.
In ~/startup we need to add the following which will create a tmux session with the name 'master', containing a window with the name 'irc' and will start 'weechat' in this window and then detach leaving the session running in the background:
/usr/bin/tmux new-session -d -s master -n irc 'weechat'