Get PID of executed process
CraftrDoinTech opened this issue · 18 comments
Describe your problem
It's supposed to open a bat file that runs a JS file that connects to the websocket server, I'm using an Ubuntu operating system, and I also tried running the server using sudo but it still won't run the start.bat for the JS file
Versions
Skript: 2.5.3
Server: 1.16.5
Skent: 3.0.0
Code
on load:
start websocket server "main" at port 4810
websocket server "main":
on message:
if event-string is "test":
send "test string recieved" to all players
on open:
send "opened websocket connection" to all players
on start:
execute file path "plugins/webserver/start.bat"
on chat:
websocket send "%event-player%~~!~~!~~%event-player's UUID%~~!~~!~~%message%" through all websockets of server at port 4810
Error
Hi,thanks you for the report.
You can't execute a .bat
file on a Ubuntu OS. Batch files are native to Windows.
If you're using a .sh
file instead, be sure the file is executable (chmod +x yourfile.sh
). You can make some checks using the %path% is executable
condition of Skent.
Hi,thanks you for the report.
You can't execute a.bat
file on a Ubuntu OS. Batch files are native to Windows.
If you're using a.sh
file instead, be sure the file is executable (chmod +x yourfile.sh
). You can make some checks using the%path% is executable
condition of Skent.
That would explain it, thank you
I'm still new to using Linux as more than just a console for running Javascript or Python files, and am grateful for the learning experience
I'd also like to ask, is there a way to kill a process with Skent?
I'd also like to ask, is there a way to kill a process with Skent?
I looked it up on skripthub and there is a way, sorry for the trouble
I'm trying everything I can but I can't figure out where to get the process ID when I start it
That's right, currently you can't get the pid of a running process from Skent, so you can't stop a process that you ran (which is obviously stupid). I change this issue in feature request then.
I'd also like to mention that starting a process even with chmod +x yourfilename.sh does nothing, it doesn't give the permissions error but it doesn't run the process and lags out the console, and takes 30 seconds or so for it to say that I issued the command /startbot
I'd also like to mention that starting a process even with chmod +x yourfilename.sh does nothing, it doesn't give the permissions error but it doesn't run the process and lags out the console, and takes 30 seconds or so for it to say that I issued the command /startbot
It might be running the process but it's not connecting to the websocket server so I highly doubt it's running it
I'm gonna have a better look in later, thanks you for details
No problem, always happy to help and give feedback to help improve things
Are you going to add a way to include arguments in the file execution? For example:
execute file path "start.sh" with arguments "testname testpassword testtoken"
or
execute file path "start.sh" with arguments "testname", "testpass", and "testtoken"
or
execute file path "test.js" with arguments "testusername"
and I haven't checked yet, but does the file execution support only sh/bat files or can I do .js or .py files as well?
you need to add support for console commands as well because at the moment there is no way to run NodeJS javascript files without a .sh or .bat file
because you run NodeJS files by putting "node filename.js" in a console or .sh or .bat file
and like I said before, running .sh files don't even do anything in Skent except for lag console, even with the right permisssions
I gonna think about that. Remember there is some security concerns with this idea (e.g rm -rf *
)
I gonna think about that. Remember there is some security concerns with this idea (e.g
rm -rf *
)
If someone has access to skript files, I think they're gonna have access to the console, so they'd just do it in the console anyways if they wanted to rm -rf to grief someone's server
also: another enhancement suggestion
a JSON file for skript permissions in certain script files
{
"files.sk": ["read files", "write to files", "create files"],
"world.sk": ["operator"],
"moderation.sk": ["kick", "ban", "ip-ban", "pardon"],
"portals.sk": ["teleport"]
}
- This is not related to the initial issue, please create another issue for that.
- Skent's goal is not to manage json data. Please use right addon for that (skript-json)
Closing because already existing: last [started] process
. Not existing in the docs, so will be updated for the next version. Please reopen this issue if the docs is not updated for Skent 3.2.0