Git Product home page Git Product logo

shawl's Introduction

Shawl

Shawl is a wrapper for running arbitrary programs as Windows services, written in Rust. It handles the Windows service API for you so that your program only needs to respond to ctrl-C/SIGINT. If you're creating a project that needs to run as a service, simply bundle Shawl with your project, set it as the entry point, and pass the command to run via CLI.

Installation

  • Prebuilt binaries are available on the releases page. It's portable, so you can simply download it and put it anywhere without going through an installer.
  • If you have Rust installed, you can run cargo install --locked shawl.
  • If you have Scoop:
    • To install: scoop bucket add extras && scoop install shawl
    • To update: scoop update && scoop update shawl
  • If you have Winget.
    • To install: winget install -e --id mtkennerly.shawl
    • To update: winget upgrade -e --id mtkennerly.shawl

Usage

Here is an example of creating a service wrapped with Shawl (note that -- separates Shawl's own options from the command that you'd like it to run):

  • Using Shawl's add command:
    • shawl add --name my-app -- C:/path/my-app.exe
  • Using the Windows sc command for more control:
    • sc create my-app binPath= "C:/path/shawl.exe run --name my-app -- C:/path/my-app.exe"
  • Then start or configure the service as normal:
    • sc config my-app start= auto
      sc start my-app
      

Shawl will inspect the state of your program in order to report the correct status to Windows:

  • By default, when your program exits, Shawl will restart it if the exit code is nonzero. You can customize this behavior with --(no-)restart for all exit codes or --restart-if(-not) for specific exit codes. Note that these four options are mutually exclusive.
  • When the service is requested to stop, Shawl sends your program a ctrl-C event, then waits up to 3000 milliseconds (based on --stop-timeout) before forcibly killing the process if necessary.
  • In either case, if Shawl is not restarting your program, then it reports the exit code to Windows as a service-specific error, unless the exit code is 0 or a code you've configured with --pass.

CLI

You can view the full command line help text in docs/cli.md.

Logging

Shawl creates a log file for each service, shawl_for_<service>_*.log (based on the --name), in the same location as the Shawl executable, with both its own messages and the output from the commands that it runs. If anything goes wrong, you can read the log to find out more. You can disable all logging with --no-log, and you can disable just the command logs with --no-log-cmd. By default, each log file is limited to 2 MB, and up to 2 rotated copies will be retained.

Accounts

Bear in mind that the default account for new services is the Local System account, which has a different PATH environment variable than your user account. If you configure Shawl to run a command like npm start, that means npm needs to be in the Local System account's PATH, or you could also change the account used by the service instead.

Also note that running a service with a Local System account is as dangerous as running a Unix service as root. This greatly increases the risk of your system being hacked if you expose a port to the public for the service you are going to wrap. It is recommended that you use a restricted account, such as Network Service, to run services. To do this, first grant the Network Service account read, write, and execute permissions on Shawl's installation directory, and then execute sc config my-app obj= "NT AUTHORITY\Network Service" password= "". If the service needs to read and write files, you may also need to grant the Network Service permissions to the directory that the service wants to access. More information about Windows service user accounts can be found here.

Recovery

If you want to use the service recovery feature of Windows itself when Shawl gives up trying to restart the wrapped command, then make sure to turn on the "enable actions for stops with errors" option in the service properties.

Comparison with other tools

Shawl differs from existing solutions like WinSW and NSSM in that they require running a special install command to prepare the service. That can be inconvenient in cases like installing a service via an MSI, where you would need to run a CustomAction. With Shawl, you can configure the service however you want, such as with the normal MSI ServiceInstall or by running sc create, because Shawl doesn't have any special setup of its own. The shawl add command is just an optional convenience.

Development

Please refer to CONTRIBUTING.md.

shawl's People

Contributors

enet4 avatar kenvix avatar mtkennerly avatar ozgb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shawl's Issues

add option doesn't quote shawl executable path if started from path containing whitespace

Reproduce:

  1. Create subdirectory with name containing spaces

  2. Copy shawl.exe to this subdirectory

  3. From this subdirectory, run command:

    shawl add --name test -- "C:\Program Files\Test App\testapp.exe"
    

Expected service command line:

   "C:\Path with Spaces\shawl.exe" run --name test -- "C:\Program Files\Test App\testapp.exe"

Actual service command line:

   C:\Path with Spaces\shawl.exe run --name test -- "C:\Program Files\Test App\testapp.exe"

If this service startup command line works (presuming testapp.exe exists in that path), then the Windows command-line parsing magic is working, but for sure security scanners will flag this as an "unquoted service path" vulnerability; e.g.: https://www.tenable.com/plugins/nessus/63155

The recommendation is to quote the executable path, thus preventing any potential exploit.

Problem with childprocess

If i use console then it works properly but when i use shawl nothing happens

I have created a express js which open if use click any button.

import { exec } from "child_process"


 exec(`start "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" "http://google.com"`)

Integrate with Window Service Recovery functions for "failure" not only for "stop with error"

Exit the service with a failure when the process exit code is not 0 and using --no-restart

It would help to somehow forward the wrapped process exit code when configured with --no-restart

In this way you can use the Windows Serive "Recovery" helpers

image


To reproduce, I have this shawl run

C:\test\shawl.exe run --name shawl-test --no-restart  --cwd "\\?\C:\test" --log-dir "\\?\C:\test" -- ping -n 1000 127.0.0.1

Start the service. It will start ok and and in the logs you will see

2023-12-07 18:48:01 [DEBUG] Entering main service loop
2023-12-07 18:48:01 [INFO] Launching command
2023-12-07 18:48:01 [DEBUG] stdout: "Pinging 127.0.0.1 with 32 bytes of data:"
2023-12-07 18:48:01 [DEBUG] stdout: "Reply from 127.0.0.1: bytes=32 time<1ms TTL=128"
2023-12-07 18:48:02 [DEBUG] stdout: "Reply from 127.0.0.1: bytes=32 time<1ms TTL=128"

Open Windows Task Manager and end the TCP Ping process.

In the logs, you will see

2023-12-07 18:49:06 [DEBUG] stdout: "Reply from 127.0.0.1: bytes=32 time<1ms TTL=128"
2023-12-07 18:49:07 [DEBUG] stdout: "Reply from 127.0.0.1: bytes=32 time<1ms TTL=128"
2023-12-07 18:49:08 [INFO] Command exited with code 1
2023-12-07 18:49:08 [DEBUG] Exited main service loop
2023-12-07 18:49:08 [DEBUG] Finished successfully

If you check Windows Event logs, in the "Windows Logs -> System" section , you will see info event ID 7036 "The shawl-test service entered the stopped state."


If instead of ending the TCP ping process, you end the shawl-exe process, you will see error event ID

7031 "The shawl-test service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 60000 milliseconds: Restart the service."


Expected result: If --no-restart is configured and wrapped process exit code is not 0, trigger a Windows Service failure.

Actual result: Even if the wrapped process exitcode is 1, the shawl Windows server is stopped like a normal succesfull stop

Not able to create service with powershell

I want to start a powershell script with shawl but as soon as I have powershell on the shawl command line the Windows service is broken.
Of course my original service registration has more arguments but I could reduce it to this simple service registration to reproduce the problem:
shawl add --name PS_Test -- "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File service_master.ps1"
or even
shawl add --name PS_Test -- powershell -File service_master.ps1

If I try to open the service properties in the Windows Services I get an error message The system cannot find the file specified.

Also the service description only contains an error message: <Failed to Read Description. Error Code: 2 >

Does anybody have an idea what could be the root cause and how to solve it?

Example on Integration into Rust App

Hi, I'd like to use the library to use a rust program as a windows service. As I understand from the readme it should be possible, right?

If you're creating a project that needs to run as a service, simply bundle Shawl with your project, set it as the entry point, and pass the command to run via CLI.

It would help me a lot if there would be a minimal example of a program that uses this functionality.

Thank you!

When running service using shawl with pyinstaller, extracted files are owned by Administrator not designated user

I am using shawl to run a python program as a Windows service. The python code is wrapped up into an .exe using pyinstaller. To create the service I execute something like the following from an elevated command (Administrator) prompt:

sc create ServiceName start=auto obj=myuser password="password" binPath = "C:\Users\me\shawl.exe run --cwd d:\wd -- c:\Users\me\python_prog.exe"

The problem is that the files unpacked from python_prog.exe are owned by Administrator and not the myuser specified with sc. One of the files is an Excel spreadsheet and when the python code, running as myuser tries to access the spreadsheet it can't because the spreadsheet is owned by Administrator. Is this a result of shawl or of pyinstaller? The files unpacked by pyinstaller are placed in C:\Users\myuser\AppData\Local\Temp. So if the files are unpacked in myuser by pyth_prog.exe running inside shawl.exe running as myuser, , why aren't they owned by myuser? If I supply a --runtime-temp argument to pyinstaller, then the files are unpacked where I specify but they are still owned by Administrator.

OS: Windows Server 2019 Datacenter
Python: 3.9.5
pyinstaller: 4.7
shawl: 1.1.0

Separating shawl logs from the wrapped executable STDOUT logs

I'd really like to be able to send the STDOUT logs from the wrapped executable/command to a different log file than the one used for shawl logging. It'd also be great if the executable's log file name/directory could be configured, and the format used.

For example, the project I'm working on has an executable which already formats logs in its own way with a datetime and debug/info/warn/error level etc., so having those log statements wrapped inside shawl log statements increases the size of the statement and makes the statements harder to read (especially when carriage returns and other special characters get escaped).

My ideal scenario would be to configure shawl to write its own logs to ./logs/shawl.log, and then the wrapped executable's STDOUT gets written to a different log file such as ./logs/<executable_name>.log with no additional formatting applied.

Improve documentation in README

README does not mention --env, --cwd or --log-dir. I needed all three and had to search through github issues to find them, since I'm not on Windows myself, but still needed to plan for using the tool on a remote server before I downloaded and installed it.

I found them all by shawl help run but perhaps that info could be added to the github site somewhere (not necessarily on README)?

Get a logo :)

Looking at https://alternativeto.net/software/shawl/about/ it looks rather sad that Shawl does not have a logo. It would look more official and professional if it had. I tried searching for Creative-Commons licensed clipart image of a shawl, but a bit hard to find.

Here are some images I generated with Dall-E:

shawl won't build due to outdated windows-service dependency.

The version of windows-service you use depends on a bad version of err-derive that uses a private symbol in quote.

It fails to build on both stable and nightly Rust.

145 | fn display_body(s: &synstructure::Structure) -> Option<quote::__rt::TokenStream> {
    |                                                               ^^^^ could not find `__rt` in `quote`

error: aborting due to previous error

This requires a new crates.io release for anyone to use shawl at the present time.

UNC Path are not supported

I have a bat file which I need to convert into a service. shawl executable is in D:\myproject\shawl\shawl.exe
I ran the following commands:

shawl add --name MyTest --cwd D:\myproject\test\ -- D:\myproject\test\run_app.bat

When I run the service I get the following error in the logs:

2024-03-02 04:57:29 [DEBUG] ********** LAUNCH **********
2024-03-02 04:57:29 [DEBUG] Cli { sub: Add { common: CommonOpts { pass: None, restart: false, no_restart: false, restart_if: [], restart_if_not: [], stop_timeout: None, no_log: false, no_log_cmd: false, log_dir: None, log_as: None, log_cmd_as: None, log_rotate: None, log_retain: None, pass_start_args: false, env: [], path: [], priority: None, command: ["D:\\myproject\\test\\run_app.bat"] }, cwd: Some("\\\\?\\D:\\myproject\\test"), dependencies: [], name: "MyTest" } }
2024-03-02 04:57:29 [DEBUG] Finished successfully
2024-03-02 04:57:42 [DEBUG] ********** LAUNCH **********
2024-03-02 04:57:42 [DEBUG] Cli { sub: Run { common: CommonOpts { pass: None, restart: false, no_restart: false, restart_if: [], restart_if_not: [], stop_timeout: None, no_log: false, no_log_cmd: false, log_dir: None, log_as: None, log_cmd_as: None, log_rotate: None, log_retain: None, pass_start_args: false, env: [], path: [], priority: None, command: ["D:\\myproject\\test\\run_app.bat"] }, cwd: Some("\\\\?\\D:\\myproject\\test"), name: "MyTest" } }
2024-03-02 04:57:42 [DEBUG] Entering main service loop
2024-03-02 04:57:42 [INFO] Launching command
2024-03-02 04:57:42 [DEBUG] stderr: "'\\\\?\\D:\\myproject\\test'"
2024-03-02 04:57:42 [DEBUG] stderr: "CMD.EXE was started with the above path as the current directory."
2024-03-02 04:57:42 [DEBUG] stderr: "UNC paths are not supported.  Defaulting to Windows directory."
2024-03-02 04:57:42 [DEBUG] stdout: "C:\\Windows>java -Dbtm.resource=resources -jar mytest.jar run schedule "
2024-03-02 04:57:42 [DEBUG] stderr: "Error: Unable to access jarfile mytest.jar"
2024-03-02 04:57:43 [INFO] Command exited with code 1

Is there a way to pass the value of cwd without converting it to UNC path?

shawl-v0.6.1-win32.exe binary from releases page does not run on Windows 7 32-bit

If I try to invoke shawl-v0.6.1-win32.exe on a Windows 7 32-bit test VM, I get confronted with:

Program 'shawl-v0.6.1-win32.exe' failed to execute: This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

This does not happen if I use the older 0.6.0 binary instead; that runs fine. Oddly enough, it also doesn't happen on a Windows 7 64-bit VM.

Even more intriguingly, if I run cargo build --target i686-pc-windows-msvc --release (when prodding this a bit to figure out if it was something I was just doing weirdly wrong, I noticed I could get complaints about missing vcruntime140.dll, so this seemed like the right target; I have Visual Studio 2019 installed on the Windows 10 system I compiled this on), the resulting binary does run fine on my Windows 7 32-bit test system.

I hope that's enough details to track down what the problem is! I'm also very willing to try any additional debugging steps, or provide any additional information, if such is necessary :)

I don't get log file per service

Thanks for this project. I was finding NSSM buggy so I switched to this. Much faster and more stable.

I managed to place logs in a different folder. I run two services "s1" and "s2", and was expecting a log file for each, i.e. shawl_for_s1.log and shawl_for_s2.log. But instead I get one file shawl_for_Shawl_rCURRENT.log, which seems like a bug?

Log rotation failed

shawl version
v1.1.1 or v1.2.0

Create Service Commamd:
sc create south-connector binPath= "\"C:\Program Files\xx\shawl.exe\" run --log-dir \"C:\Program Files\xx\south-connector\logs\" --name south-connector --cwd \"C:\Program Files\xx\south-connector\" -- south-connector.exe" start= auto

Service Info:
image

The Criterion for rotating log files works, but cleanup does not.
image

Windows Version
版本 Windows 11 家庭中文版
版本 22H2
安装日期 ‎2022/‎10/‎8
操作系统版本 22621.1992
体验 Windows Feature Experience Pack 1000.22644.1000.0

Service not receiving stop signal at system shutdown

Hello Mtkennerly,

Let me start off by saying that I like your project very much because it saved me a lot of time!
But still I ran in to a problem.
When the system is shutting down my service stops, but in the logs I don't see a stop signal.
When I stop my service trough windows service manager the stop signal is getting logged and my app starts the graceful shutdown process like expected.

Maybe you can point me in the right direction because I cant seem to figure out what is going wrong?

How to run a .bat file?

I have a bat file with basically a while true loop, how do I set it to run with shawl?
I have tried shawl.exe run --name serviceName -- "FULL_PATH_TO_THE_BAT_FILE" and it fails. I cannot use cmd /c start because i understand that start won't wait and shawl will restart my service.
Is it possible to run a bat file?
Thanks!

Option to set environment and PATH

We set some local configuration with ENVs, e.g. secrets. Furthermore, our exes needs to reach some special DLLs, hence the need to prepend to PATH.

As inspiration, Apache's Procrun Daemon recognises --LibraryPath to prepend to PATH and ++Environment to set ENVs. It's used e.g. by tomcat.

Example for ENVs on the basis of this structopt example:

shawl run --env FOO=C:\bar\baz --env PORT=8888 -- <my_bin>

Example for paths with value_delimiter(";"):

shawl run --paths C:\abc;C:\xyz -- <my_bin>

Would it be meaningful to introduce one or both options in shawl or you'd propose a config wrapper for such cases?

Question on argument handling

I'm trying to better understand run_service to possibly extend and contribute. Hence, I'm wondering why start_arguments are not used to parse the Cli but ::from_args().

Wouldn't the other way around be more idiomatic or am I missing some caveat here?

Windows xp support?

Hi!
At work, I need to be able to deploy some apps in legacy computers that still run XP and run them as services. I have tried the binary from the release page and it did not work. I tried to compile it myself using some flags to choose the platform with no luck (disclaimer: i'm really a newbie with rust).

Do you think this is even possible?

Running service without admin rights

Hi,

I'm using https://github.com/Badgerati/Pode to run a web server and I found shawl as a solution to run this as a service since the whole webserver is in a powershell script.

I'd like to run the service without admin rights so after creating the service with shawl (using an admin user) I open the services.msc and change the service user.

The service user can run the webserver without problems when calling it directly (powershell.exe server.ps1) but starting the service results in "Permission denied".

The exact error message is

Error: OutputiO(Os { code: 5, kind: PermissionDenied, message: "Permission denied" })

Is shawl causing this?

Usage

I am using it for node JS express server?

I have tried to use it like this

shawl add --name express -- yarn start

But it doesn't seem to start?

And I think to make it run on startup so I think the best way is to move to startup folder which we can access by shell:startup on run?

Custom log path for "shawl_for"

Thank you for making this project. 🙂

Wondering if you could add parameter to allow custom log path for shawl_for_<service>_*.log instead of at the shawl executable. I understand that there is a possibility of redirecting the logs but then it might be harder to maintain the size or rotation.

Negative exit codes are not handled properly

Hi,
thanks for this awesome tool!

This is just for reporting a possible bug: it seems to me that shawl is handling negative exit codes properly.
For example, this command line below:

shawl.exe add --pass -2 --name MyService -- Process.exe

results in:

error: Found argument '-2' which wasn't expected, or isn't valid in this context
...

I get the same for any arguments involving exit codes (e.g. --restart-if).

Am I missing something?

Thanks!

Marco

can't create app

shawl add --name myapp -- 'D:\soft\myApp.exe'

[ERROR] Failed to create the service. Error code: 1072.
[ERROR] SC stdout:
[SC] OpenSCManager ʧ�� 1072:

�ܾ����ʡ�


[ERROR] SC stderr:

Service fails to start at AllocConsole

I am reporting this error here just in the case in which someone else hit it.

[ERROR] winapi AllocConsole failed with code 31

From the Windows API docs

ERROR_GEN_FAILURE 31 (0x1F) A device attached to the system is not functioning.


I am not sure why this stopped working.
The shawl used to work, I did a Windows OS update and now it no longer works.

I am still troubleshooting this.

Most probably this is not an shawl error... and just a WIndows setup.

Disable logging

Hi.

Is there any option to disable the logging?

Thank you!

isn't valid in this context

Hi,

i try this on powershell shell

PS C:\Users\toto\Documents\toto\bin\navidrome\navidrome_0.47.5_Windows_x86_64> sudo shawl add --name Navidrome -- "C:\Users\toto\Documents\toto\bin\navidrome\navidrome_0.47.5_Windows_x86_64\navidrome.exe" -c "C:\Users\toto\Documents\toto\bin\navidrome\navidrome_0.47.5_Windows_x86_64\config\navidrome.toml"

I have this error

error: Found argument 'C:\Users\toto\Documents\toto\bin\navidrome\navidrome_0.47.5_Windows_x86_64\navidrome.exe' which wasn't expected, or isn't 
valid in this context

USAGE:
    shawl.exe add [FLAGS] [OPTIONS] --name <name> [--] <command>...

For more information try --help

i don't understand the error
and i follow sample on navidrome doc
and doc of readme.

What is the problem ?

Best regards.

Configuring a different max log size and rotated log file retention

@mtkennerly Thank you so much for building shawl! I was previously trying to use nssm and despite its name I found it rather sucky. On the other hand shawl is working perfectly for me so far 💯

The project I am using shawl for writes a lot of logs, like easily 100-200Mb per day, and I would like to keep a rolling fortnight or months' worth if possible. As an aside, I see that flexi_logger also supports age based rotation, so my ideal scenario would be to configure shawl to rotate files every day and retain 14 or 32 files.

Would it be possible to expose the logging configuration (size or age for rotation, and number of rotated files retained) as CLI arguments to shawl so that we can customize/tailor the logging to suit the executable/command being wrapped?

Some programs don't end gracefully.

I am trying to run a non-native Redis service in a local development environment. It starts normally, but it doesn't end gracefully, Ctrl-C doesn't seem to work.

I use the following command to create the service.
shawl.exe add --name Redis --cwd D:\programs\Redis -- redis-server.exe redis.conf

When I run redis-service.exe redis.conf directly, Ctrl-C is valid, and when I press it produces the following output.

166:M 27 Mar 2024 15:17:29.284 * Server initialized
166:M 27 Mar 2024 15:17:29.284 * Loading RDB produced by version 7.2.4
166:M 27 Mar 2024 15:17:29.284 * RDB age 577 seconds
166:M 27 Mar 2024 15:17:29.285 * RDB memory usage when created 0.54 Mb
166:M 27 Mar 2024 15:17:29.285 * Done loading RDB, keys loaded: 0, keys expired: 0.
166:M 27 Mar 2024 15:17:29.285 * DB loaded from disk: 0.001 seconds
166:M 27 Mar 2024 15:17:29.285 * Ready to accept connections tcp
166:signal-handler (1711523851) Received SIGINT scheduling shutdown...
166:M 27 Mar 2024 15:17:31.392 * User requested shutdown...
166:M 27 Mar 2024 15:17:31.393 * Saving the final RDB snapshot before exiting.
166:M 27 Mar 2024 15:17:31.397 * DB saved on disk
166:M 27 Mar 2024 15:17:31.397 * Removing the pid file.
166:M 27 Mar 2024 15:17:31.397 # Redis is now ready to exit, bye bye...

And if I start the service through shawl, when I end the service, the output looks like this.

2024-03-27 15:54:43 [DEBUG] stdout: "1789:M 27 Mar 2024 15:54:43.279 * Server initialized"
2024-03-27 15:54:43 [DEBUG] stdout: "1789:M 27 Mar 2024 15:54:43.280 * Loading RDB produced by version 7.2.4"
2024-03-27 15:54:43 [DEBUG] stdout: "1789:M 27 Mar 2024 15:54:43.280 * RDB age 1906 seconds"
2024-03-27 15:54:43 [DEBUG] stdout: "1789:M 27 Mar 2024 15:54:43.280 * RDB memory usage when created 0.54 Mb"
2024-03-27 15:54:43 [DEBUG] stdout: "1789:M 27 Mar 2024 15:54:43.280 * Done loading RDB, keys loaded: 0, keys expired: 0."
2024-03-27 15:54:43 [DEBUG] stdout: "1789:M 27 Mar 2024 15:54:43.280 * DB loaded from disk: 0.000 seconds"
2024-03-27 15:54:43 [DEBUG] stdout: "1789:M 27 Mar 2024 15:54:43.280 * Ready to accept connections tcp"
2024-03-27 15:54:51 [INFO] Received stop event
2024-03-27 15:54:51 [INFO] Sending ctrl-C to command
2024-03-27 15:54:54 [INFO] Killing command because stop timeout expired
2024-03-27 15:54:54 [DEBUG] Exited main service loop
2024-03-27 15:54:54 [DEBUG] Finished successfully

I don't know what caused the difference. Did I use the wrong command?

adding version to shawl.exe properties

hi , i'm a user of shawl.exe .

could please the version of shawl be added to the shawl.exe properties
like on the picture below .
this would make it easier to manually and programatically
see the different shawl.exe versions on different machines ,
where shawl is installed on .

shawl exe properties with version

stop service from gui report error

can start the service through the service properties interface, but when it stops, an error is reported, see windows event log,
display:101 The exclusive semaphore is owned by another process.

Weird CWD that makes the application fail

With this command

.\shawl.exe --help
shawl 1.0.0

.\shawl.exe add --name MyApp --stop-timeout 30000 --restart --cwd . -- MyApp.exe

I get this in Windows service "Path to executable":

C:\Users\dev\Temp\MyApp.win-x64.0.8.1\shawl.exe run --name MyApp --stop-timeout 30000 --restart --cwd \\?\C:\Users\dev\Temp\MyApp.win-x64.0.8.1 -- MyApp.exe

The problem is the weird \\?\ in the cwd parameter, that prevent the app from running appropriately.

Rev 1.1.1 failed to start but 1.0.0 worked

I installed the windows 64 bit version 1.1.1 on Microsoft Windows Server 2019 Datacenter Version 10.0.17763 Build 17763. The command to create the service was:
sc create Syncthing DisplayName= "Syncthing" start= delayed-auto depend= NlaSvc binPath= "C:\syncthing\shawl.exe run --no-restart --cwd C:\syncthing --name Syncthing --restart-if 3,4 --stop-timeout 10000 -- C:\syncthing\syncthing.exe -no-restart -no-browser -home=C:\syncthing\home"
I used the services gui to set the user and password.

The service failed to start and the following (edited) events occurred:

Log Name: System
Source: Service Control Manager
Date: 10/10/2022 7:06:35 PM
Event ID: 7009
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: servername.local
Description:
A timeout was reached (300000 milliseconds) while waiting for the Syncthing service to connect.

Log Name: System
Source: Service Control Manager
Date: 10/10/2022 7:06:35 PM
Event ID: 7000
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: servername.local
Description:
The Syncthing service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.

I replaced version 1.1.1 with 1.0.0 and it then worked as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.