Header Image

Starting Programs on Boot/Reboot with Cron and Tmux

When rebooting your PC or server, there may be programs or small scripts that you would want to have load on boot, such as IRC clients or shell scripts. Even though you can manually start them when you log in, it's more convenient to have these scripts run automatically. Fortunately cron jobs make it possible to automate processes in this sense, and tools like screen or tmux can make it so you don't need to keep a terminal window and SSH connection open 24/7.


To start a program, you can easily launch a program in tmux with:

tmux new-session -d -s <program> '<program>'


To launch the above script and/or example with a cron job (via crontab) type crontab -e and add the following line:

@reboot tmux new-session -d -s <program> '<program>'



tmux new-session -d -s weechat 'weechat'


@reboot tmux new-session -d -s weechat 'weechat'