If you have a Wincable or any other Internet account that uses Cyberoam Software for login.. And u are pissed off by the Linux client that is buggy in terms of logging off or login.
Here is a python script (My first useful python program) that logs in and logs out correctly. Without leaving a trace of /tmp/crclient.pid
You can put the script in the $HOME/bin directory. So that it is visible in $PATH.
Usage
Login
$ wincable start
Logout
$ wincable stop
You can alternatively download the script
Configuration of 2 variables is required
- CLIENT_DIR – The directory in which crclient binary resides
- USERNAME – Login name of the user
#!/usr/bin/python
import os, time, sys
'''Tool to log into the wincable system, first checks if any
process is running, if yes, kills it and then invokes the binary client'''
#=======================================================
#===================== CONFIGURATION ===================
CLIENT_DIR = '/home/rutu/crclient'
USERNAME = "rushiraj"
#=======================================================
#=======================================================
os.chdir(CLIENT_DIR)
def startClient():
stopClient()
removeFile()
print "Starting client ..."
login = "./crclient -u " + USERNAME
start = os.popen(login)
# start.read()
print
print
def removeFile():
#Forcefully remove pid file if any
os.popen("rm -fr /tmp/crclient.pid")
def stopClient():
# Check for existing process, if found, terminate, kill
p = os.popen("ps ax | grep 'crclient -u' | grep -v grep")
pss = p.read()
if (pss != ""):
# process is running, try to terminate
print "Terminating process ..."
os.popen("./crclient -l")
time.sleep(1)
removeFile()
#Check first argument
command = sys.argv[1]
if command == "start":
startClient()
elif command == "stop":
stopClient()
# vim: set ft=python:
The directory in which crclient binary resides means which directory
if your crclient script/file exists in /home/rutu/crclient/bin – then /home/rutu/crclient/bin is the residing directory
tq
but i got an error at this line command = sys.argv[1]
index error=index out of range