| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Control.Shell.Posix
Description
Working with daemons, users, groups, file permissions and file ownerships.
   Not present on Windows unless shellmate is installed with the with-posix
   flag.
Synopsis
- type User = String
 - type Group = String
 - getCurrentUser :: Shell String
 - getCurrentGroups :: Shell [String]
 - getOwner :: FilePath -> Shell User
 - getGroup :: FilePath -> Shell Group
 - getOwnership :: FilePath -> Shell (User, Group)
 - setOwner :: User -> FilePath -> Shell ()
 - setGroup :: Group -> FilePath -> Shell ()
 - setOwnership :: User -> Group -> FilePath -> Shell ()
 - data CMode
 - unionFileModes :: FileMode -> FileMode -> FileMode
 - intersectFileModes :: FileMode -> FileMode -> FileMode
 - nullFileMode :: FileMode
 - ownerReadMode :: FileMode
 - ownerWriteMode :: FileMode
 - ownerExecuteMode :: FileMode
 - ownerModes :: FileMode
 - groupReadMode :: FileMode
 - groupWriteMode :: FileMode
 - groupExecuteMode :: FileMode
 - groupModes :: FileMode
 - otherReadMode :: FileMode
 - otherWriteMode :: FileMode
 - otherExecuteMode :: FileMode
 - otherModes :: FileMode
 - stdFileMode :: FileMode
 - accessModes :: FileMode
 - setFileMode :: FilePath -> CMode -> Shell ()
 - getFileMode :: FilePath -> Shell CMode
 - setFileCreationMask :: CMode -> Shell CMode
 - daemonize :: Shell () -> Shell ()
 
Users and groups
getCurrentUser :: Shell String Source #
Get the currently effective user name.
getCurrentGroups :: Shell [String] Source #
Get the list of groups associated with the current process.
setOwnership :: User -> Group -> FilePath -> Shell () Source #
Set the owner and group of the given file.
File permissions
Instances
| Bounded CMode | |
| Enum CMode | |
Defined in System.Posix.Types  | |
| Eq CMode | |
| Integral CMode | |
| Num CMode | |
| Ord CMode | |
| Read CMode | |
| Real CMode | |
Defined in System.Posix.Types Methods toRational :: CMode -> Rational #  | |
| Show CMode | |
| Storable CMode | |
| Bits CMode | |
Defined in System.Posix.Types Methods (.&.) :: CMode -> CMode -> CMode # (.|.) :: CMode -> CMode -> CMode # xor :: CMode -> CMode -> CMode # complement :: CMode -> CMode # shift :: CMode -> Int -> CMode # rotate :: CMode -> Int -> CMode # setBit :: CMode -> Int -> CMode # clearBit :: CMode -> Int -> CMode # complementBit :: CMode -> Int -> CMode # testBit :: CMode -> Int -> Bool # bitSizeMaybe :: CMode -> Maybe Int # shiftL :: CMode -> Int -> CMode # unsafeShiftL :: CMode -> Int -> CMode # shiftR :: CMode -> Int -> CMode # unsafeShiftR :: CMode -> Int -> CMode # rotateL :: CMode -> Int -> CMode #  | |
| FiniteBits CMode | |
Defined in System.Posix.Types Methods finiteBitSize :: CMode -> Int # countLeadingZeros :: CMode -> Int # countTrailingZeros :: CMode -> Int #  | |
unionFileModes :: FileMode -> FileMode -> FileMode #
Combines the two file modes into one that contains modes that appear in either.
intersectFileModes :: FileMode -> FileMode -> FileMode #
Combines two file modes into one that only contains modes that appear in both.
No permissions.
Owner has read permission.
Owner has write permission.
ownerExecuteMode :: FileMode #
Owner has execute permission.
ownerModes :: FileMode #
Owner has read, write and execute permission.
Group has read permission.
Group has write permission.
groupExecuteMode :: FileMode #
Group has execute permission.
groupModes :: FileMode #
Group has read, write and execute permission.
Others have read permission.
Others have write permission.
otherExecuteMode :: FileMode #
Others have execute permission.
otherModes :: FileMode #
Others have read, write and execute permission.
stdFileMode :: FileMode #
Owner, group and others have read and write permission.
accessModes :: FileMode #
Owner, group and others have read, write and execute permission.
setFileMode :: FilePath -> CMode -> Shell () Source #
Set the mode (permissions, etc.) of the given file.
Daemonizing shell computations
daemonize :: Shell () -> Shell () Source #
Daemonize a shellmate computation. This should be the last thing a
   computation does, as this function will terminate the parent computation.
   In short, daemonizing a computation involves setting the file creation
   mask to 0, closing standard input, output and error file descriptors,
   blocking sighup and changing the working directory to /.
On Windows without Cygwin, daemonize is a no-op. Consider running any
   program intended to be deamonized using START /B your_app, or better yet,
   rewriting it as a Windows service.