fix socket permission
This commit is contained in:
parent
64ac9ad155
commit
c22f0ce97c
2 changed files with 9 additions and 9 deletions
4
PKGBUILD
4
PKGBUILD
|
@ -1,6 +1,6 @@
|
|||
# Maintainer: 1ridic <i@8f.al>
|
||||
pkgname=uptimes
|
||||
pkgver=0.1.3
|
||||
pkgver=0.1.4
|
||||
pkgrel=2
|
||||
pkgdesc="status of total uptime"
|
||||
arch=('any')
|
||||
|
@ -11,7 +11,7 @@ source=(
|
|||
local://uptimes
|
||||
local://uptimesd.service
|
||||
)
|
||||
md5sums=('e70411e89528c1d4f55fdbf97c4e4736'
|
||||
md5sums=('17dfb70e8c5d7c21d13fca3f16c07d02'
|
||||
'7a90889f87792317e70ebdce9dae7023')
|
||||
|
||||
package() {
|
||||
|
|
14
uptimes
14
uptimes
|
@ -90,6 +90,11 @@ def pathExists():
|
|||
|
||||
def daemon(fork = True):
|
||||
global uptime, now, s
|
||||
|
||||
if os.path.exists(socket_file):
|
||||
print('Uptimesd already running')
|
||||
sys.exit(1)
|
||||
|
||||
# fork
|
||||
if fork:
|
||||
pid = os.fork()
|
||||
|
@ -132,15 +137,10 @@ def daemon(fork = True):
|
|||
import setproctitle
|
||||
setproctitle.setproctitle('uptimesd')
|
||||
|
||||
# create socket file
|
||||
try:
|
||||
os.unlink(socket_file)
|
||||
except OSError:
|
||||
if os.path.exists(socket_file):
|
||||
raise
|
||||
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
s.bind(socket_file)
|
||||
# socket file permission 777
|
||||
os.chmod(socket_file, 0o777)
|
||||
s.listen(1)
|
||||
|
||||
# handle signal
|
||||
|
|
Loading…
Reference in a new issue