Linux-Noob Forums

Full Version: Start screen irssi on boot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I've been using screen + irssi for a while now (ssh from work to home :)), but in the last weeks I have had to deal with some power outages. So I have been wondering a couple of things

 

1. how do I start screen and irssi as a certain user on boot.

 

2. how do I configure that the pc starts back up when the poser returns (prolly A bios option but don't wanna reboot it (great uptime now :P))


Quote:1. how do I start screen and irssi as a certain user on boot.
 

Certainly it is possible. In fact I use it! I used this source here. This requires a utility called "start-stop-daemon". If you don't have that then you can download this and compile it but most system have it now a days.

 

Any issues just as me! :)

 

Quote:2. how do I configure that the pc starts back up when the poser returns (prolly A bios option but don't wanna reboot it (great uptime now :P))
 

Yeah has to be a bios option, look for power options, particular restart on power loss .. etc.


Another possibility is to use cron which has the nice @reboot option.

 

Edit your crontab with:



Code:
$ crontab -e




 

Then add this:



Code:
@reboot /usr/bin/screen irssi





Some issues with screen can result in:

Quote:Must be connected to a terminal
 

So one work around that I have figured out is this:



Code:
% ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/mark/.ssh/id_rsa): /home/mark/.ssh/id_localhost Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/mark/.ssh/id_localhost. Your public key has been saved in /home/mark/.ssh/id_localhost.pub. The key fingerprint is: 7c:63:29:a2:ae:08:ed:8b:ff:15:63:1a:7e:9f:14:22 mark@tone % cat /home/mark/.ssh/id_localhost.pub /home/mark/.ssh/authorized_keys >tempfile % mv tempfile /home/mark/.ssh/authorized_keys mv: overwrite `/home/mark/.ssh/authorized_keys'? y % vi .ssh/config (add this into the file) Host lo HostKeyAlias localhost HostName localhost IdentityFile /home/mark/.ssh/id_localhost User mark Port 22 (save the file) % ssh lo Last login: Sat Jan 5 14:47:41 2008 % exit Connection to localhost closed.




 

Now we have a working connection to localhost. So what we want in our crontab is this:

 



Code:
@reboot ssh lo screen -d -m irssi




 

Tada .. work around complete. You might need to make the public key entry under root's account if you use the global crontab.


So, ZNX and I couldn't get this working at all. Something was preventing my machine from accepting the public keys. Well here is the fix I finally found, hours later.

I added the following line to my users crontab with crontab -e

 



Code:
@reboot /usr/bin/screen -d -m irssi




 

We had tried this as @reboot /usr/bin/screen irssi, which did not work.

Hope this helps someone cause I know I found very little helpful info from my searches online

Why the heck didn't I try that first .. heh anyway!