make pid file directory
This commit is contained in:
parent
96950a3b40
commit
e0cd977669
1 changed files with 1 additions and 0 deletions
|
@ -46,6 +46,7 @@ daemonize logfd pidfile changedirectory a = do
|
||||||
- Fails if the pid file is already locked by another process. -}
|
- Fails if the pid file is already locked by another process. -}
|
||||||
lockPidFile :: FilePath -> IO ()
|
lockPidFile :: FilePath -> IO ()
|
||||||
lockPidFile file = do
|
lockPidFile file = do
|
||||||
|
createDirectoryIfMissing True (parentDir file)
|
||||||
fd <- openFd file ReadWrite (Just stdFileMode) defaultFileFlags
|
fd <- openFd file ReadWrite (Just stdFileMode) defaultFileFlags
|
||||||
locked <- catchMaybeIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
|
locked <- catchMaybeIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
|
||||||
fd' <- openFd newfile ReadWrite (Just stdFileMode) defaultFileFlags
|
fd' <- openFd newfile ReadWrite (Just stdFileMode) defaultFileFlags
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue