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

How to autostart promnesia server in Windows (install-server) #331

Open
AnweshGangula opened this issue Jun 27, 2022 · 2 comments
Open

How to autostart promnesia server in Windows (install-server) #331

AnweshGangula opened this issue Jun 27, 2022 · 2 comments

Comments

@AnweshGangula
Copy link
Contributor

The documentation mentions that we can use promnesia install-server in Linux and OSX to autostart promnesia server, but it doesn't talk about Windows.

Is there a way to do this in Windows?

@karlicoss
Copy link
Owner

Sorry, no idea -- I don't use Windows really. It must be possible, since Windows has services (or even simpler 'autostart' shortcuts)

@AnweshGangula
Copy link
Contributor Author

AnweshGangula commented Dec 4, 2023

I was able to setup a Task Scheduler in Windows and trigger it to automatically run on Windows Startup using the below script:

cmd /c ""C:\Program Files\Git\bin\bash.exe" --login -i -- %USERPROFILE%\Downloads\promnesiaServe.sh"

Note that I was only able to get it work using Git Bash. running command directly in cmd or powershell did not work


Below are the steps:

  1. Create a bash file with the below script
    #!/bin/bash
    cd /D/Source_Code/GitHub/promnesia # this is the path to my local clone of the promnesia repo
    # echo Change Directory done
    
    ./scripts/promnesia serve
  2. Save the file in your PC. I saved it here: %USERPROFILE%\Downloads\promnesiaServe.sh
  3. Then open the Task Scheduler in Windows from the start menu
  4. Click "Create a Basic Task"
  5. Provide a name to the task - I used Run Promnesia Serve
  6. in the Next Scree, choose a Trigger - I chose When computer starts and click Next
  7. In the Next Screen, choose Start a Program and click Next
  8. Then enter the below values in the respective input fields:
    a. Program/Script: use either cmd or C:\Windows\System32\cmd.exe
    b. Add arguments (optional): input /c ""C:\Program Files\Git\bin\bash.exe" --login -i -- %USERPROFILE%\Downloads\promnesiaServe.sh"
  9. Click Next and Finish to create a task. This will be automatically run when you restart your Windows

Note that sometimes the Task Scheduler doesn't start the task on Windows Start, so its better to add a 5 mins delay in the Trigger, which will ensure the task to be run.


Reference:

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

No branches or pull requests

2 participants