Skip to content
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

[Bug Report] run as a service nssm start JMusicBot not working #1444

Open
3 tasks done
itsmeredback opened this issue Oct 10, 2023 · 5 comments
Open
3 tasks done

[Bug Report] run as a service nssm start JMusicBot not working #1444

itsmeredback opened this issue Oct 10, 2023 · 5 comments

Comments

@itsmeredback
Copy link

Bug Description

i tried starting the bot by running the command nssm start JMusicBot but it there is an error it sez Can't open service! OpenService(): Access is denied.

Steps to Reproduce

honestly.. i can do anything for fixing this bug.

Expected Result

i expected the command to work properly... Instead this error came.. Please help

Debug Output

WhatsApp Image 2023-10-10 at 8 56 32 PM

Additional Info

i'm guessing its a bug from my side but just to make sure please check.

Checklist

@Matej7Lite
Copy link

Hey, did you managed to create the service? I did and It still doesnt work.

Zadaná služba již existuje. - ( The service already exists.)
Instance této služby je již spuštěna. - (An instance of this service is already running.)
image

@chilux00
Copy link

chilux00 commented Oct 30, 2023

Hey, I had the same issue + also a similar issue with the nssm start command returning "SERVICE_PAUSED" error. Did some web crawling and saw that there were a lot of people with the same issue that didn't have a clear solution. I managed to fix this myself by editing the service settings, dropping what I did below in case it will help you too!

  • If you've renamed your bot file to anything other than JMusicBot.jar (version number doesn't matter), change commands as needed.
  • Launch cmd prompt as admin (right click -> Run as administrator) or else you won't have perms to start or add anything.
  • Make sure that the nssm executable (.exe file) is in the same folder as JMusicBot.jar (you may have to go into the nssm files and drag the file out into the main bot folder).
  • Set working directory to cd <directory address of the .jar file here>
  • Install as usual with nssm install JMusicBot java -jar JMusicBot.jar (no need to append version numbers to the .jar file name).
  • DON'T start the service yet - if you already have it started, stop it first with nssm stop JMusicBot

Fix starts here!

  • Run nssm edit JMusicBot to bring up the GUI for editing the service. You should see three editable text fields pop up.
  • For the first field, "Path", set this to the path of your java.exe. This is probably in your program files so you can find it in your C:\ drive.
  • For the second field "Startup Directory", set this to the path of the working directory folder (i.e the folder where your JMusicBot file is), something like C:\Users\<User Name>\Documents\<Folder Name>
  • For the last field "Arguments", you want to append -jar and set it to the exact path of your music bot .jar file, so something like -jar C:\Users\<User Name>\Documents\<Folder Name>\JMusicBot-0.3.9.jar. If you've renamed your .jar file, change this accordingly.

@Yarmoon
Copy link

Yarmoon commented Nov 19, 2023

  • For the second field "Startup Directory", set this to the path of the working directory folder (i.e the folder where your JMusicBot file is), something like C:\Users\<User Name>\Documents\<Folder Name>

This worked for me, thank you!

@Matej7Lite
Copy link

It didn't work until I set up java and nssm as permanent admin

@chilux00
Copy link

It didn't work until I set up java and nssm as permanent admin

I believe this can be bypassed if you run both programs as admin locally, as well as the initial terminal in cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants