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

Can not start server with PowerShell and ionosctl server start command #430

Closed
matthiasmett opened this issue Mar 25, 2024 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@matthiasmett
Copy link

Description

If i want to start a server with the commands

ionosctl login --user "USER" --password "PASSWORT" --force

ionosctl server start --datacenter-id "DATACENTER-ID" --server-id "SERVER-ID" --wait-for-request --force

in PowerShell, the single lines worked and start the server. If i create a PowerShell script with the two lines and start the file with the Task Scheduler in Windows Server, the server did not start.

If i create a PowerShell script with the ionosctl server stop command and start it with the Windows Task Scheduler, it worked and the server stopped.

Expected behavior

Why did a PowerShell script executed in Windows Task-Scheduler with the stop-command worked and with the start-command not?

Environment

IONOS Enterprise Cloud

Ionosctl version:
Latest, just installed.

OS:
Windows Server 2019

@matthiasmett matthiasmett added the bug Something isn't working label Mar 25, 2024
@glimberea
Copy link
Contributor

Hi! Please provide the following so that we have a bit more information on the issue:

  • the specs of the server you're trying to start
  • the location in which the server is provisioned
  • the OS of the server
  • the output of the start script when run with IONOS_LOG_LEVEL=trace

@matthiasmett
Copy link
Author

Hi,
here are the specifications:

  • the specs of the server you're trying to start
    Virtual Maschine in IONOS DCD
    CPU Intel Xeon
    Cores 2
    RAM 16 GB
    HDD 100 GB

  • the location in which the server is provisioned
    Data Center: Germany/Berlin

  • the OS of the server
    Window Server 2019/2022

  • the output of the start script when run with IONOS_LOG_LEVEL=trace
    Can not execute IONOS_LOG_LEVEL=trace in PowerShell

@glimberea
Copy link
Contributor

glimberea commented Apr 3, 2024

  • Can not execute IONOS_LOG_LEVEL=trace in PowerShell

IONOS_LOG_LEVEL needs to be set as an environment variable. Also, the host server might require a restart in order to actually recognize that the variable has been set.

@matthiasmett
Copy link
Author

Can you describe how to create an environment variable in IONOS Data Center Designer?

@glimberea
Copy link
Contributor

Hello, sorry for the slow reply! The environment variable should be set within Windows, on the machine that is supposed to be running the script with Task Scheduler.

I, however, have not been able to reproduce the issue. The Powershell script runs without issue both with the start and with the stop command. I believe this might be a scheduling issue with the Task Scheduler. I would recommend contacting customer support for further assistance. Their email is support@cloud.ionos.com.

I suggest providing them the logs from the script after you set the environment variable.

@avirtopeanu-ionos
Copy link
Contributor

avirtopeanu-ionos commented Apr 22, 2024

Hi, I also couldn't reproduce this. I would remove the login command from the job since it generates a new token for every login. You only need one successful login in this case, which you can run manually separately from the job.

Also the job might hang if you have some bad credentials. I suggest piping the output to a log file using powershell. Here's an example of how to capture output using powershell by just using your job's args :

Program / Script: powershell.exe
Add Arguments (optional): -Command "& 'script-path-here.ps1' *> 'log-file-here.txt'"

Regarding the environment variable, it's meant to be set on your local machine (or on the machine running the script) and can be done via powershell: $env:MY_VARIABLE = "MyValue" i.e. $env:IONOS_LOG_LEVEL = "trace"

I'll close this issue, but feel free to comment if you still encounter something unexpected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants