Ch4r0ne / ARK-Ascended-Server-Manager

ARK Survival Ascended Server Manager
MIT License
37 stars 5 forks source link

Auto-start on reboot #26

Open jordan-dalby opened 8 months ago

jordan-dalby commented 8 months ago

An auto-start toggle would be nice. My server reboots every night, so having an option to auto-start on reboot would be very nice. Also, is there a way that I can force a save just before the restart? (I'm running ubuntu server with a win10 vm).

Ch4r0ne commented 8 months ago

Heyy @jordandalby no problem, use this skpt to create a startup job, so you use the same skirpt as for updating

# Set the path to the file to be executed
$psScriptPath = "$env:APPDATA\ARK-Ascended-Server-Manager\AutoUpdateJob.ps1"

# Set the task name
$taskName = "MeinCustomTask"

# Create the trigger for "at startup"
$trigger = New-ScheduledTaskTrigger -AtStartup

# Create the action to run PowerShell with the script path as an argument
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "-ExecutionPolicy Bypass -File `"$psScriptPath`""

# Register the task in the Task Scheduler
Register-ScheduledTask -TaskName $taskName -Trigger $trigger -Action $action -RunLevel Highest -User "SYSTEM"
Elcoach103 commented 7 months ago

where would i add this at, mines reboots also