/** * Returns the current hostname */ public String hostname() { return cmd(HOSTNAME); }
public String ps() { return cmd(PS); }
public String cmd(String executable) { return cmd(executable, null); }
public String cmd(String executable, List<String> args) { return cmd(executable, args, false); }
/** * Sets the current hostname */ public String hostname(String hostname) { return cmd(HOSTNAME, Arrays.asList(hostname)); }
public String psf(String user) { Assert.hasText(user); List<String> args = new ArrayList<String>(); args.add("-u"); args.add(user); args.add("-f"); return cmd(PS, args); }
public String kill(List<Integer> pids) { Assert.notEmpty(pids); List<String> args = new ArrayList<String>(); for (Integer pid : pids) { args.add(pid.toString()); } return cmd(KILL, args); }
public String nohup(String command, List<String> nohupArgs) { Assert.hasText(command); List<String> args = new ArrayList<String>(); args.add(command); args.addAll(nohupArgs); return cmd(NOHUP, args); }
public String su(List<String> options, String login, List<String> args) { List<String> list2 = login == null ? null : Arrays.asList("-", login); return cmd(SU, CollectionUtils.combineStrings(options, list2, args)); }
public String ps(String user) { Assert.hasText(user); return cmd(PS, Arrays.asList("-u", user)); }
public String cp(List<String> options, String src, String dst, boolean bypassAnyAliases) { Assert.hasText(src, "src has no text"); Assert.hasText(dst, "dst has no text"); List<String> args = new ArrayList<String>(); args.addAll(CollectionUtils.toEmptyList(options)); args.add(src); args.add(dst); return cmd(CP, args, bypassAnyAliases); }
public String rm(List<String> options, List<String> paths) { Assert.notEmpty(paths); return cmd(RM, CollectionUtils.combineStrings(options, paths)); }
public String mkdir(List<String> options, List<String> paths) { Assert.notEmpty(paths); return cmd(MKDIR, CollectionUtils.combineStrings(options, paths)); }
public String chmod(List<String> options, String mode, List<String> paths) { Assert.hasLength(mode); Assert.notEmpty(paths); return cmd(CHMOD, CollectionUtils.combineStrings(options, mode, paths)); }
public String chown(List<String> options, String owner, String group, List<String> paths) { Assert.notEmpty(paths); Assert.noBlanks(owner, group); return cmd(CHOWN, CollectionUtils.combineStrings(options, owner + ":" + group, paths)); }