コード例 #1
0
ファイル: __init__.py プロジェクト: mikeder/cherrymusic
    def create_pid_file(cls):
        """create a process id file, exit if it already exists"""
        if pathprovider.pidFileExists():
            sys.exit(_("""============================================
Process id file %s already exists.
I've you are sure that cherrymusic is not running, you can delete this file and restart cherrymusic.
============================================""") % pathprovider.pidFile())
        else:
            with open(pathprovider.pidFile(), 'w') as pidfile:
                pidfile.write(str(os.getpid()))
コード例 #2
0
ファイル: __init__.py プロジェクト: samuelyeungkc/cherrymusic
    def create_pid_file(cls):
        """create a process id file, exit if it already exists"""
        if pathprovider.pidFileExists():
            with open(pathprovider.pidFile(), 'r') as pidfile:
                try:
                    os.getpgid(int(pidfile.read()))
                    sys.exit(_("""============================================
Process id file %s already exists.
I've you are sure that cherrymusic is not running, you can delete this file and restart cherrymusic.
============================================""") % pathprovider.pidFile())
                except ProcessLookupError:
                    print('Stale process id file, removing.')
                    cls.delete_pid_file()
        with open(pathprovider.pidFile(), 'w') as pidfile:
            pidfile.write(str(os.getpid()))
コード例 #3
0
ファイル: __init__.py プロジェクト: samuelyeungkc/cherrymusic
    def create_pid_file(cls):
        """create a process id file, exit if it already exists"""
        if pathprovider.pidFileExists():
            with open(pathprovider.pidFile(), 'r') as pidfile:
                try:
                    os.getpgid(int(pidfile.read()))
                    sys.exit(
                        _("""============================================
Process id file %s already exists.
I've you are sure that cherrymusic is not running, you can delete this file and restart cherrymusic.
============================================""") % pathprovider.pidFile())
                except ProcessLookupError:
                    print('Stale process id file, removing.')
                    cls.delete_pid_file()
        with open(pathprovider.pidFile(), 'w') as pidfile:
            pidfile.write(str(os.getpid()))
コード例 #4
0
ファイル: __init__.py プロジェクト: Isgar/cherrymusic
    def create_pid_file(cls):
        """create a process id file, exit if it already exists"""
        if pathprovider.pidFileExists():
            with open(pathprovider.pidFile(), 'r') as pidfile:
                try:
                    if not sys.platform.startswith('win'):
                        # this call is only available on unix systems and throws
                        # an OSError if the process does not exist.
                        os.getpgid(int(pidfile.read()))
                    sys.exit(_("""============================================
Process id file %s already exists.
If you are sure that cherrymusic is not running, you can delete this file and restart cherrymusic.
============================================""") % pathprovider.pidFile())
                except OSError:
                    print('Stale process id file, removing.')
                    cls.delete_pid_file()
        with open(pathprovider.pidFile(), 'w') as pidfile:
            pidfile.write(str(os.getpid()))
コード例 #5
0
ファイル: __init__.py プロジェクト: noinip/cherrymusic-1
    def create_pid_file(cls):
        """create a process id file, exit if it already exists"""
        if pathprovider.pidFileExists():
            with open(pathprovider.pidFile(), 'r') as pidfile:
                try:
                    if not sys.platform.startswith('win'):
                        # this call is only available on unix systems and throws
                        # an OSError if the process does not exist.
                        os.getpgid(int(pidfile.read()))
                    sys.exit(_("""============================================
Process id file %s already exists.
If you are sure that cherrymusic is not running, you can delete this file and restart cherrymusic.
============================================""") % pathprovider.pidFile())
                except OSError:
                    print('Stale process id file, removing.')
                    cls.delete_pid_file()
        with open(pathprovider.pidFile(), 'w') as pidfile:
            pidfile.write(str(os.getpid()))
コード例 #6
0
ファイル: __init__.py プロジェクト: mikeder/cherrymusic
 def delete_pid_file(cls):
     """Delete the process id file, if it exists"""
     if pathprovider.pidFileExists():
         os.remove(pathprovider.pidFile())
     else:
         print(_("Error removing pid file, doesn't exist!"))