Another short aide-mémoire. My IRC client is irssi, running in a screen session on my linux server in London. I connect to it via SSH, but if the server restarts I want this all set up automatically. Fire up crontab -e
and add the following:
@reboot /usr/bin/screen -dmUS irc /usr/bin/irssi
A brief rundown of the options:
@reboot
: run this cron job when the cron daemon is restarting after a reboot-dm
: start screen in ‘detached’ mode-U
: run screen in UTF-8 mode (see my other post)-S irc
: give the screen session a friendly name, for reattaching using-r
This requires that the irssi configuration at least have all the channel and server configuration and is set to auto-connect, of course.
What about starting irssi for the correct user at reboot? Would it then be:
@reboot /bin/su -c “/usr/bin/screen -dmUS irc /usr/bin/irssi” youruser
Hi Mark,
The example I give in the post above is for a user’s own crontab, so there’s no need to specify the username. The screen/irssi session will be started “as” that user automatically. That is, run the “crontab -e” command as “youruser”.
If you want to do something globally on the server for one or more users, then I’d try creating a file in /etc/cron.d/ and adding the “username” field, like this:
@reboot youruser /usr/bin/screen -dmUS irc /usr/bin/irssi
I hope this helps.