AoservDaemon starts all of the services that run inside the Java VM.
TODO: List AoservDaemon at http://www.firewalld.org/
- Author:
- AO Industries, Inc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final ExecutorServiceAn unbounded executor for daemon-wide tasks. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidExecutes a command, opens then immediately closes the command's input, and discards the output.static voidExecutes a command, opens then immediately closes the command's input, and discards the output.static StringexecAndCapture(File workingDirectory, String... command) Executes a command, opens then immediately closes the command's input, and captures the output.static StringexecAndCapture(String... command) Executes a command, opens then immediately closes the command's input, and captures the output.static byte[]execAndCaptureBytes(File workingDirectory, String... command) Executes a command, opens then immediately closes the command's input, and captures the output.static byte[]execAndCaptureBytes(String... command) Executes a command, opens then immediately closes the command's input, and captures the output.static <V> VexecCall(ConsumerE<? super OutputStream, ? extends IOException> stdin, FunctionE<? super InputStream, V, ? extends IOException> stdout, File workingDirectory, String... command) Executes a command, performing any arbitrary action with the command's output stream.static <V> VexecCall(ConsumerE<? super OutputStream, ? extends IOException> stdin, FunctionE<? super InputStream, V, ? extends IOException> stdout, String... command) Executes a command, performing any arbitrary action with the command's output stream.static <V> VexecCall(FunctionE<? super InputStream, V, ? extends IOException> stdout, File workingDirectory, String... command) Executes a command, performing any arbitrary action with the command's output stream.static <V> VexecCall(FunctionE<? super InputStream, V, ? extends IOException> stdout, String... command) Executes a command, performing any arbitrary action with the command's output stream.static voidexecRun(ConsumerE<? super InputStream, ? extends IOException> stdout, File workingDirectory, String... command) Executes a command, performing any arbitrary action with the command's output stream.static voidexecRun(ConsumerE<? super InputStream, ? extends IOException> stdout, String... command) Executes a command, performing any arbitrary action with the command's output stream.static voidexecRun(ConsumerE<? super OutputStream, ? extends IOException> stdin, ConsumerE<? super InputStream, ? extends IOException> stdout, File workingDirectory, String... command) Executes a command, performing any arbitrary action with the command's output stream.static voidexecRun(ConsumerE<? super OutputStream, ? extends IOException> stdin, ConsumerE<? super InputStream, ? extends IOException> stdout, String... command) Executes a command, performing any arbitrary action with the command's output stream.static voidfindUnownedFiles(File file, Collection<Integer> uids, List<File> deleteFileList, int recursionLevel) Recursively searches for any files that are not owned by a UID in the provided list.static StringgetCommandString(String... command) Gets a single-String representation of the command.static AoservConnectorstatic RandomA fast pseudo-random number generator for non-cryptographic purposes.static SecureRandomA single random number generator is shared by all daemon resources.static Serverstatic voidRuns theAoservDaemonwith the values provided incom/aoindustries/aoserv/daemon/aoserv-daemon.properties.static voidSwitches to the specified user and executes a command.
-
Field Details
-
DEBUG
public static final boolean DEBUG- See Also:
-
executorService
An unbounded executor for daemon-wide tasks.
-
-
Method Details
-
getSecureRandom
A single random number generator is shared by all daemon resources.Note: This is not a strong instance to avoid blocking.
-
getFastRandom
A fast pseudo-random number generator for non-cryptographic purposes. -
findUnownedFiles
public static void findUnownedFiles(File file, Collection<Integer> uids, List<File> deleteFileList, int recursionLevel) throws IOException Recursively searches for any files that are not owned by a UID in the provided list. If an unowned file is found and is a directory, its contents are not searched. To avoid infinite recursion, symbolic links are not followed but may be deleted.- Parameters:
file- theFileto search fromuids- theIntListcontaining the list of uids- Throws:
IOException
-
getConnector
- Throws:
ConfigurationException
-
getThisServer
- Throws:
IOExceptionSQLException
-
main
Runs theAoservDaemonwith the values provided incom/aoindustries/aoserv/daemon/aoserv-daemon.properties. This will typically be called by the init scripts of the dedicated machine. -
getCommandString
Gets a single-String representation of the command. This should be used for display purposes only, because it doesn't quote things in a shell-safe way. -
execCall
public static <V> V execCall(ConsumerE<? super OutputStream, ? extends IOException> stdin, FunctionE<? super InputStream, throws IOExceptionV, ? extends IOException> stdout, File workingDirectory, String... command) Executes a command, performing any arbitrary action with the command's output stream. Command's input is written on the current thread. Command's output is read, and handled, on a different thread. Command's error output is also read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
execCall
public static <V> V execCall(ConsumerE<? super OutputStream, ? extends IOException> stdin, FunctionE<? super InputStream, throws IOExceptionV, ? extends IOException> stdout, String... command) Executes a command, performing any arbitrary action with the command's output stream. Command's input is written on the current thread. Command's output is read, and handled, on a different thread. Command's error output is also read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
execRun
public static void execRun(ConsumerE<? super OutputStream, ? extends IOException> stdin, ConsumerE<? super InputStream, throws IOException? extends IOException> stdout, File workingDirectory, String... command) Executes a command, performing any arbitrary action with the command's output stream. Command's input is written on the current thread. Command's output is read, and handled, on a different thread. Command's error output is also read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
execRun
public static void execRun(ConsumerE<? super OutputStream, ? extends IOException> stdin, ConsumerE<? super InputStream, throws IOException? extends IOException> stdout, String... command) Executes a command, performing any arbitrary action with the command's output stream. Command's input is written on the current thread. Command's output is read, and handled, on a different thread. Command's error output is also read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
execCall
public static <V> V execCall(FunctionE<? super InputStream, V, throws IOException? extends IOException> stdout, File workingDirectory, String... command) Executes a command, performing any arbitrary action with the command's output stream. Command's input is opened then immediately closed. Command's output is read, and handled, on the current thread. Command's error output is read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
execCall
public static <V> V execCall(FunctionE<? super InputStream, V, throws IOException? extends IOException> stdout, String... command) Executes a command, performing any arbitrary action with the command's output stream. Command's input is opened then immediately closed. Command's output is read, and handled, on the current thread. Command's error output is read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
execRun
public static void execRun(ConsumerE<? super InputStream, ? extends IOException> stdout, File workingDirectory, String... command) throws IOExceptionExecutes a command, performing any arbitrary action with the command's output stream. Command's input is opened then immediately closed. Command's output is read, and handled, on the current thread. Command's error output is read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
execRun
public static void execRun(ConsumerE<? super InputStream, ? extends IOException> stdout, String... command) throws IOExceptionExecutes a command, performing any arbitrary action with the command's output stream. Command's input is opened then immediately closed. Command's output is read, and handled, on the current thread. Command's error output is read on a different thread.The command's standard error is logged to
System.err.Any non-zero exit value will result in an exception, including the standard error output when available.
- Throws:
IOException
-
exec
Executes a command, opens then immediately closes the command's input, and discards the output.- Throws:
IOException- See Also:
-
exec
Executes a command, opens then immediately closes the command's input, and discards the output.- Throws:
IOException- See Also:
-
execAndCapture
Executes a command, opens then immediately closes the command's input, and captures the output.- Throws:
IOException
-
execAndCapture
Executes a command, opens then immediately closes the command's input, and captures the output.- Throws:
IOException
-
execAndCaptureBytes
public static byte[] execAndCaptureBytes(File workingDirectory, String... command) throws IOException Executes a command, opens then immediately closes the command's input, and captures the output.- Throws:
IOException
-
execAndCaptureBytes
Executes a command, opens then immediately closes the command's input, and captures the output.- Throws:
IOException
-
suexec
public static void suexec(User.Name username, File workingDirectory, String command, int nice) throws IOException Switches to the specified user and executes a command.- Parameters:
nice- a nice level passed to /bin/nice, a value of zero (0) will cause nice to not be called- Throws:
IOException
-
