How to achieve auto login and log off on Google accounts on time based . I am using the chat client is EMPATHY
Linux – How to Set Up Auto Login for Gtalk
automatic-logonempathygoogle-talklinux
automatic-logonempathygoogle-talklinux
How to achieve auto login and log off on Google accounts on time based . I am using the chat client is EMPATHY
Best Answer
First you'll need a way to schedule tasks. If you're not familiar with
cron
, and you're using Ubuntu/GNOME thensudo apt-get install gnome-schedule
. Then you can open Scheduled Tasks from the System >> Preferences menu and use the GUI to set a specific time for a command to run.The simplest way to schedule a time for Empathy to connect and disconnect is to just schedule jobs to start and stop the program (just use the commands
empathy
andkillall empathy
). The problem is that if we kill Empathy without logging out then you'll still appear signed in for a few minutes until Google discovers that you've timed out.To get around that problem we can use D-Bus to send a signal to Empathy's backend that asks it to disconnect. There are lots of ways to do this including with
dbus-send
from the command line, but since I'm more familiar with Python I used that.Instead of configuring your sign-off task to call
killall empathy
, save the following script somewhere (e.g.~/empathy_signout.py
) and then schedule your task to call that (python ~/empathy_signout.py
). Replace the stringEXAMPLE
in the fourth line with your Google Talk account name before you save the file.This script could be tweaked to avoid the hacky guess of the account name path component, or to sign on also (If quitting the program is a problem). Take a look at the ConnectionManager interface in the Telepathy D-Bus docs if this stuff doesn't frighten you.