示例#1
0
 public EndpointResult <string> EnableAutoMount(string uuid, Partition partition)
 {
     try
     {
         var result           = new EndpointResult <string>();
         var kebabDisplayName = partition.DisplayName.ToKebabCase();
         _cron.Add("@reboot", $"sudo mount -t auto /dev/disk/by-uuid/{uuid} /mnt/armnas/{kebabDisplayName}");
         result.Succeed = true;
         result.Result  = "Partition auto mount enabled.";
         return(result);
     }
     catch (Exception) // details are logged in OSCommander's ILogger
     {
         return(new EndpointResult <string>()
         {
             Succeed = false,
             ErrorMessage = "http.autoMountEnableError",
             StatusCode = 461
         });
     }
 }
示例#2
0
 public ActionResult <CronEntry> Create([FromBody] CronEntry cronEntry)
 {
     _cron.Add(cronEntry.Cron, cronEntry.Command);
     return(Ok(cronEntry));
 }