Fix for Python3
This commit is contained in:
parent
a8fe1900e6
commit
5d90fd7c3f
2 changed files with 4 additions and 6 deletions
|
|
@ -8,7 +8,6 @@ from grp import getgrnam
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import syslog
|
import syslog
|
||||||
from string import split
|
|
||||||
|
|
||||||
import usb.core
|
import usb.core
|
||||||
|
|
||||||
|
|
@ -59,7 +58,7 @@ if len( filelist ) != 1:
|
||||||
|
|
||||||
# Found file. Parse out the PID of the process that created it.
|
# Found file. Parse out the PID of the process that created it.
|
||||||
lockfile = filelist[0]
|
lockfile = filelist[0]
|
||||||
oldpid = split( lockfile, '_' )[1]
|
oldpid = lockfile.split( '_' )[1]
|
||||||
|
|
||||||
# syslog.syslog( "%d: Check for path /proc/%s" % (pid, oldpid) )
|
# syslog.syslog( "%d: Check for path /proc/%s" % (pid, oldpid) )
|
||||||
if not os.path.exists( "/proc/%s" % oldpid ):
|
if not os.path.exists( "/proc/%s" % oldpid ):
|
||||||
|
|
@ -67,7 +66,7 @@ if not os.path.exists( "/proc/%s" % oldpid ):
|
||||||
# syslog.syslog( "%d: Renaming %s to mustang_%d" % (pid, lockfile, pid) )
|
# syslog.syslog( "%d: Renaming %s to mustang_%d" % (pid, lockfile, pid) )
|
||||||
try:
|
try:
|
||||||
os.rename( lockfile, "mustang_%d" % os.getpid() )
|
os.rename( lockfile, "mustang_%d" % os.getpid() )
|
||||||
except Exception, e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
# syslog.syslog( "%d: Unable to rename file" % pid )
|
# syslog.syslog( "%d: Unable to rename file" % pid )
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
import os
|
import os
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from syslog import syslog
|
from syslog import syslog
|
||||||
from string import split
|
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
|
|
@ -17,7 +16,7 @@ filelist = glob( 'mustang_*' )
|
||||||
|
|
||||||
if len( filelist ) == 1:
|
if len( filelist ) == 1:
|
||||||
lockfile = filelist[0]
|
lockfile = filelist[0]
|
||||||
oldpid = split( lockfile, '_' )[1]
|
oldpid = lockfile.split( '_' )[1]
|
||||||
|
|
||||||
# See if the process still exists
|
# See if the process still exists
|
||||||
# syslog( "%d: Check for path /proc/%s" % (pid, oldpid) )
|
# syslog( "%d: Check for path /proc/%s" % (pid, oldpid) )
|
||||||
|
|
@ -25,7 +24,7 @@ if len( filelist ) == 1:
|
||||||
# syslog( "%d: Sending sigint to pid %s" % (pid, oldpid) )
|
# syslog( "%d: Sending sigint to pid %s" % (pid, oldpid) )
|
||||||
try:
|
try:
|
||||||
os.kill( int(oldpid), signal.SIGINT )
|
os.kill( int(oldpid), signal.SIGINT )
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
syslog( "%d: Signal failed: %s" % (pid, e) )
|
syslog( "%d: Signal failed: %s" % (pid, e) )
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue