ubuntuusers.de

Powershell Cronjob

Status: Ungelöst | Ubuntu-Version: Ubuntu 16.04 (Xenial Xerus)
Antworten |

ubuntu_for_life

Anmeldungsdatum:
28. Februar 2018

Beiträge: Zähle...

Ich habe unter Ubuntu 16.04 ein Powershell Script erstellt, welches Powercli verwendet, um auf 2 Esxi Hosts, Snapshosts zu löschen und zu erstellen. Was auch prima funktioniert wenn ich die Scripts direkt ausführe, aber als Cronjob funktioniert das nicht. Im Syslog sehe ich folgendes:

(v6.1.0-preview.2:1:80) [Perftrack_ConsoleStartupStop:PowershellConsoleStartup.WinStop.Informational] PowerShell console is ready for user input

Crontab sieht wie folgt aus:

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
* * * * * /usr/local/bin/vsphere-influxdb-go
0 22 * * * sudo cp -r /dockerdata/ /Storage/01_Privat/02_Tech/02_Home_Network/03_Backup/01_Docker/
0 22 * * * /usr/local/bin/esx-1-create-new-snapshots.ps1
0 22 * * * /usr/local/bin/esx-1-remove-snapshots-older-than-5-days.ps1
0 22 * * * /usr/local/bin/esx-2-create-new-snapshots.ps1
0 22 * * * /usr/local/bin/esx-2-remove-snapshots-older-than-5-days.ps1

Hat jemand eine Ahnung was hier das Problem sein könnte?

Bearbeitet von sebix:

Codebloecke.

Antworten |