-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to run external commands in background or from crontab #212
Comments
What do you mean by "not working"? Variants:
? Typically I use |
From Crontab
From nohup
I suspect it is not able to pipe correctly in the background. Instead if use a similar tool like netcat (for send/receive)
|
Note that you may want try
|
foreachmsg:cmd immediately exits as reported earlier by other people.
For now I ended up writing another websocket client to execute the command after receiving the message (in background). this is not ideal but not a deal breaker either. Atleast I was able to run web socket server and sender without writing code. It is only the receiver part which doesn't seem to work in background mode. |
Note that instead of |
Tried some command lines: Maybe you want Also you need to modify |
I'm running this in production from last 3 weeks weeks. On an average it crashes once every 24 hours without providing anything in stdout or stderr. I have written a crontab script that runs every minute and if websocat server is down it simply restarts it. Therefore it is not causing a serious problem. However do you think wsbroad is more stable than running websocat with broadcast:mirror. Is there a known problem? |
Websocat is not expected to require periodic restarts. Maybe something wrong is happening? What do you mean by "crashes"? Process exits? (with what exit code?). Is it a high-load scenario or Weboscat is mostly waiting?
It is much simpler than Websocat and it uses modern dependencies (tokio-tungstenite). Note that it differs from |
load is very minimal hardly 100 concurrent subscribers. yes process exits without writing anything to stdout or stderr. i'm redirecting both 1 and 2 to a file. unfortunately core dump is not enabled on production server which could have revealed the actual cause of the problem. it is very hard to reproduce the error. i will replace websocat with wsbroad and see how it goes. if you want to close the issue please feel free to close it as i'm not able to provide any stack trace because core is not enabled on production server. i use the websocat behind haproxy tunnel not sure if this matters. reason haproxy is used to provide consistent ssl connection on 443 port. Once again thank you for all the help and great work. |
Hi, I experienced similar issue and it was very frustrating. I guess websocat uses some heuristic to determine if stdin is open, which works differently in foreground and background. my logs: [INFO websocat::ws_client_peer] Connected to ws
|
I don't remember any explicit detection of background vs foreground mode in Websocat1.
Are you using
What is the command line? |
websocat 1.13.0
it's either It may not be explicit but my best guess it's implicitly closes the stream when one of its end closed. Which means that when stdin is closed the connection is closed by default. |
i have setup broadcast mirror server, there is no problem with that. there is no problem with sender too.
sender.sh - OK
echo X | websocat -k -E -t - wss://127.0.0.1:9000
receiver.sh
websocat -E -k -t wss://127.0.0.1:9000 | xargs -r -n1 print_args.sh
receiver.sh works only from interactive shell.
i) ./receiver.sh - OK
ii) nohup ./receiver.sh & - NOT working
iii) adding receiver.sh to crontab doesn't work either.
i tried to redirect to named pipe in receiver.sh but that didn't work either. similar tools like netcat works without any problem in sender/receiver.sh.
The text was updated successfully, but these errors were encountered: